網頁

2013年4月11日

git snippet

Commit the changes into mutiple branch

Assume there are 2 brach, ‘master’, ‘2013Q1-branch’
git br –a
Change to master branch
git co master
Commit the changes
git add –i
git commit
gitt push

Lookup commit number. for example ‘3ec1b5b’
git la
Change to ‘2013Q1-branch’ branch
git co 2013Q1-branch
Apply the changes introduced by some existing commits
git cherry-pick 3ec1b5b
Modify log for the changes
git commit --amend

Commit the changes to this branch
git push

Remove all commits not in origin/master
git reset --hard origin/master

Show more line in diff mode
git diff -U100