git commit –amend –no-edit
git push -f origin some_branch
git clean -f
git clean -d
git merge --no-ff
git add -p # patch mode可以将一个文件分成多份来进行提交，适合于当一次内容里面修改了多方面的东西的时候。
git fetch 获取到所有的branch,然后执行
git checkout -t <name of remote>/test or
git checkout -b test <name of remote>/test
git pull –rebase origin master
git rebase -i对已有的commit进行整理，另一方面是对于branch层面上的，避免merge的时候出现分叉，使用
git pull --rebase来进行merge，同时也可以有两个设置
- squash merge
the meaning of
ours are not the same in
git merge and
git rebase, reference.
Cherry-pick works best compared to all other methods while pushing a specific commit.
The way to do that is:
Create a new branch:
Update your new-branch with your origin branch:
These actions will make sure that you exactly have the same stuff as your origin has.
Cherry-pick the sha id that you want to do push:
Push it to your origin:
gitk to see that everything looks the same way you wanted.
git rebase -i will do it.
First, start with a clean working directory: git status should show no pending modifications, deletions, or additions.
To split apart your most recent commit, first:
$ git reset HEAD~
Now commit the pieces individually in the usual way, producing as many commits as you need.
If it was farther back in the tree, then
$ git rebase -i HEAD~3
where 3 is how many commits back it is.
If it was farther back in the tree than you want to count, then
$ git rebase -i 123abcd~
123abcd is the SHA1 of the commit you want to split up.
When you get the rebase edit screen, find the commit you want to break apart. At the beginning of that line, replace
e for short). Save the buffer and exit. Rebase will now stop just after the commit you want to edit. Then:
$ git reset HEAD~
Commit the pieces individually in the usual way, producing as many commits as you need, then
$ git rebase --continue
git push 之前记得做一次
git pull --rebase origin master.
git log –name-status -10 path/to/dir
git revert commit-id, add a new commit to revert that commit
git checkout <commit_hash> -- <file>
git clean -fd