We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
push local code to new created repo $ git init $ vim .gitignore $ git add -A $ git commit -m "init" $ git remote add origin https://etaf@github.... $ git push origin master
push local code to new created repo
$ git init $ vim .gitignore $ git add -A $ git commit -m "init" $ git remote add origin https://etaf@github.... $ git push origin master
remote file from git repo $ git rm file $ git rm -r dir
remote file from git repo
$ git rm file $ git rm -r dir
added but not commit, rm file added: $ git rm --cached file
added but not commit, rm file added:
$ git rm --cached file
force replace local code with server code: $ git reset --hard $ git pull origin master
force replace local code with server code:
$ git reset --hard $ git pull origin master
cheate a new branch and switch to it: $ git checkout -b branch-name
cheate a new branch and switch to it:
$ git checkout -b branch-name
push local branch to remote server: $ git push origin branch-name
push local branch to remote server:
$ git push origin branch-name
fetch remote branch from remote server: $ git fetch origin
fetch remote branch from remote server:
$ git fetch origin
replace local branch with server branch: $ git reset --hard HEAD~3 # HEAD~3 means rollback 3 commit versions $ git pull
replace local branch with server branch:
$ git reset --hard HEAD~3 # HEAD~3 means rollback 3 commit versions $ git pull
if you make a mistake when using: git reset --hard , then the commits before it would lose(see git log), how to recover them ? $ git reflog $ git reset --hard <sha>
if you make a mistake when using: git reset --hard , then the commits before it would lose(see git log), how to recover them ?
$ git reflog $ git reset --hard <sha>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: