|
|
(20 intermediate revisions by 4 users not shown) |
Line 1: |
Line 1: |
| = Scripted git commands for a linear history =
| |
|
| |
|
| * All developments MUST use the following scripts and workflow to maintain a linear git history in TubeTK
| |
| * These scripts are published online at
| |
| ** http://www.dinnermint.org/tutorial/dead-simple-git-workflow-for-agile-teams
| |
|
| |
| == gitupdate (script) ==
| |
|
| |
| #!/bin/sh -x
| |
| # hack: Merge the latest changes from the master branch into your current branch
| |
| ref=$(git symbolic-ref HEAD 2> /dev/null) || exit 0
| |
| CURRENT="${ref#refs/heads/}"
| |
| git checkout master
| |
| git pull origin master
| |
| git checkout ${CURRENT}
| |
| git rebase master
| |
|
| |
| == gitship (script) ==
| |
|
| |
| #!/bin/sh -x
| |
| # Git workflow ship script from: http://reinh.com/blog/2008/08/27/hack-and-and-ship.html
| |
| # git name-rev is fail
| |
| ref=$(git symbolic-ref HEAD 2> /dev/null) || exit 0
| |
| CURRENT="${ref#refs/heads/}"
| |
| git checkout master
| |
| git merge ${CURRENT}
| |
| git push origin master
| |
| git checkout ${CURRENT}
| |
|
| |
| == Using the Scripts ==
| |
|
| |
| The above scripts should be used in a workflow as:
| |
|
| |
| > git branch *newTopic*
| |
| > git checkout *newTopic*
| |
| > *do some work*
| |
| > git add *files*
| |
| > git commit *files*
| |
| > gitupdate
| |
| > *do some more work*
| |
| > git add *files*
| |
| > git commit *files*
| |
| > gitupdate
| |
| > gitship
| |
|
| |
| === Hidden details ===
| |
| * The above scripts and workflow implement the following, and save you much typing and potential errors!
| |
| * Most importantly, do your work in branches, not in master!
| |
| # Keep a local master branch which only is a pointer to the gitorious master (does not contain local changes)
| |
| # Make development modification in a local branch
| |
| # When getting ready to push these changes to the origin try the following
| |
| ## Do a git pull on master to fetch and merge all changes from gitorious
| |
| ### '''git checkout master'''
| |
| ### '''git pull origin master'''
| |
| ## Do a git rebase of the topic branch onto master - That is with topic checkout do "git rebase master"
| |
| ### '''git rebase master topic'''
| |
| ## Fix any conflicts that result
| |
| ### Edit files
| |
| ### '''git add -u'''
| |
| ### '''git rebase --continue'''
| |
| ## Merge the topic branch - This will result in an fast-forward merge.
| |
| ### '''git merge topic'''
| |
| ## git push your local master branch
| |
| ### '''git push origin master'''
| |