public
Last active

Guide for git branches, remotes and merge requests

  • Download Gist
git guide
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
# clone your fork of qa-reports from gitorious
git clone git@gitorious.org:~shaofengtang/meego-quality-assurance/release-version-qa-reports.git
 
# create a branch to follow upstream, i.e., qa-reports/master
git checkout -b upstream
 
# configure upstream repository in order to pull in new changes easily
git remote add upstream git://gitorious.org/meego-quality-assurance/qa-reports.git
git pull upstream master
 
# from now on, this will pull fresh origin/master to your upstream branch
git checkout upstream && git pull upstream master
 
# upstream test cases should always pass, otherwise there's something wrong in the environment
rake spec && rake cucumber
 
# start your feature development by branching from the current upstream
git checkout upstream && git pull upstream master && git checkout -b fea-my-new-awesome-feature
 
# do the development and all the commits
git commit ...
...
...
git commit
 
# write tests and check that all the tests pass
rake spec && rake cucumber
 
# bring your feature up-to-date with qa-reports/master by rebasing
git checkout upstream && git pull upstream master && git checkout fea-my-new-awesome-feature
git rebase upstream
 
# check that everything works after rebase
rake spec && rake cucumber
 
# now git diff with upstream should show only your changes and nothing else
git diff upstream
 
# -> perfect time to create a merge request! :)
# Please note that the updating upstream and rebasing your changes should be done again in case
# we request you to update the merge request.
# Please note also it's usually easier to follow upstream if you rebase your branch often,
# e.g., daily, instead of one big rebase after a week or so.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.