Contents

Something About Git

use rebase

1
    git rebase
Reapply commits from one branch on top of another branch.
Commonly used to "move" an entire branch to another base, creating copies of the commits in the new location.

more commit information is generated when using ‘git pull origin projectA’, instead, use following

1
2
    git fetch origin          //pull origion to local
    git merge origin/master projectA //merge gakki's master branch to projectA

combine commits

use

1
git rebase -i HEAD~4

reset

1
2
git reset --hard commitID   //resets to commitID
git reset --soft commitID   //resets the commit but still keep the local copy
1
git reflog

Reference logs, or “reflogs”, record when the tips of branches and other references were updated in the local repository.

git stash

can’t change branch to checkout when there is not commit so use stack to store the commit

1
2
git stash
git stash pop

git grep keyword

split commit

1
2
3
4
5
6
7
8
    git rebase -i HEAD~5
    /choose commitID
    /edit
    git rebase –continue
    git rebase HEAD^
    git add
    git commit
    git rebase -continue