Git Tips
1
| repo forall -c "pwd && git status" 2>&1 | tee status.txt # check status for each project
|
- Find commit list which contains [function]
1
| git show `git log --oneline [path-to-file] | cut -c 1-8` | egrep -rs "[function]|commit"
|
1
2
3
| git log --oneline --author=[email]
git branch --contains [commit id]
git log -S"keyword" [path-to-file]
|
1
| git commit --amend --author=[email]
|
1
2
3
4
| git rebase -i HEAD~[number_of_commits]
edit
git commit --amend
git rebase --continue
|
1
2
3
4
| git reset --hard [commit-id]
git reset --soft @{1}
git reset --hard HEAD
git reset --hard HEAD^
|
1
2
| git branch -r
git remote show origin
|
1
2
| git log --oneline [tag1]..[tag2]
git log --oneline [branch1]..[branch2]
|
1
2
3
| git format-patch <commit id>^! # generate patch w.r.t. commit id
git format-patch -1 # generate patch w.r.t. top commit
git cherry-pick <commit id> # cherry pick commit
|