Git Tips
check local modification
git stash
temporally store modification in stash.git stash pop
restore modification from stash.git checkout .
cancel all local modification.git reset --hard HASH
reset to certainHASH
commit, losing all local modification.
ssh -T git@github.com
test your ssh connection with github.for certain case: you may need to last commitment ;create another branch, then go back to master branch
git cherry-pick <commit id>
git cherry-pick
is a powerful command that enables arbitrary git commits to be picked by reference and appended to the current working branch HEAD. It is the act of picking commit from a branch and applying it to another branch.
show your git remote repository
git remote -v
orgit remote show orgin
modified git commit comments
- if you just want to modify the comment that you just committed.
git commit --amend
(please use vim as default in terminal)git push -f
- if you just want to modify the last \(N^{th}\) comment that you just committed.
git rebase -i HEAD~N
first you go back- modify the comment and replace
pick
withedit
in corresponding line git commit --amend
do it againgit rebase --continue
you can come back nowgit push -f
- if you have local modification, try
git stash
(to archive modifications) andgit stash pop
(restore)
- if you just want to modify the comment that you just committed.