1. return back to the last commit:
git checkout -f
2. return back to any commit:
"git hist" to show all the commit
"git checkout 7-letter code" to change the HEAD
do not change the branch before create a new branch, if not, the work will be lost.
3. create a new branch and switch over, delete
"git checkout -b name_new_branch "
4. start up and set up personnel information
git init
git config --global user.name "your name"
git config --global user.email "your_email@whatever.com"
5. restore the modification not yet staging
git checkout "file"
6. restore the modification staging but not yet committing
git reset HEAD^
7. squashing commits
git rebase -i HEAD~num_of_commit_to_squash
8. patch
make a patch between the current branch and the master: git diff master > file.patch
after switching to the master, apply the patch: git apply file.patch
git apply -check for verifying the availability of the patch
9. modify the latest commit
git commit -amend -m "new commit message"
No comments:
Post a Comment