From: Peng Li Date: Sun, 18 Dec 2016 13:04:32 +0000 (+0800) Subject: add git-note file X-Git-Url: http://47.100.26.94:8080/?a=commitdiff_plain;h=5a912b88fcfddbe3d91ceca9ed6d9c7b02a14ec1;p=blog.git add git-note file --- diff --git a/git-note.org b/git-note.org new file mode 100644 index 0000000..67f41e7 --- /dev/null +++ b/git-note.org @@ -0,0 +1,39 @@ +#+TITLE: Git Note +#+AUTHOR: Peng Li +#+EMAIL: seudut@gmail.com +#+DATE: 2016-12-18 + +* Git Note +** Update an forked repo on Github +See [[http://stackoverflow.com/questions/7244321/how-do-i-update-a-github-forked-repository]] +#+BEGIN_SRC sh :results output replace + # Add the remote, called it "upstream", which is the original repo forked + + git remote add upstream https://github.com/whoever/whatever.git + + # Fetch upstream + + git fetch upstream + + # switch to master + + git checkout master + + # rebase all commit in upstream + + git rebase upstream/master + + # push the new commit + + git push origin master +#+END_SRC + +** Move branch pointer to commit +Ususally, we create a branch for some bug fix. If it is a regress issue, we oftern need to rollback to some commit to fix the +bad commit. In this case, we need to move the branch to another commit +[[http://stackoverflow.com/questions/5471174/git-move-branch-pointer-to-different-commit-without-checkout]] + +#+BEGIN_SRC sh :results output replace + git branch -f branch-name COMMIT +#+END_SRC +