3 #+EMAIL: seudut@gmail.com
7 ** Update an forked repo on Github
8 See [[http://stackoverflow.com/questions/7244321/how-do-i-update-a-github-forked-repository]]
9 #+BEGIN_SRC sh :results output replace
10 # Add the remote, called it "upstream", which is the original repo forked
12 git remote add upstream https://github.com/whoever/whatever.git
22 # rebase all commit in upstream
24 git rebase upstream/master
28 git push origin master
31 ** Move branch pointer to commit
32 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
33 bad commit. In this case, we need to move the branch to another commit
34 [[http://stackoverflow.com/questions/5471174/git-move-branch-pointer-to-different-commit-without-checkout]]
36 #+BEGIN_SRC sh :results output replace
37 git branch -f branch-name COMMIT
40 ** Track local branch to remote branch
41 Sometime, we enter the issue =no upstream is configured for master=, It is because of local branch tracking is not configured
42 If you input ~git pull~, it hints the error
44 peli3@[~/Private/blog]>> git pull ±[••][master]
45 There is no tracking information for the current branch.
46 Please specify which branch you want to merge with.
47 See git-pull(1) for details.
49 git pull <remote> <branch>
51 If you wish to set tracking information for this branch you can do so with:
53 git branch --set-upstream-to=origin/<branch> master
56 #+BEGIN_SRC sh :results output replace
57 git branch --set-upstream-to=origin/master master