Permalink
Browse files

doc: git tips got updated with more clean git usage

  • Loading branch information...
priit committed Oct 28, 2009
1 parent 99391e3 commit f32263a8b55224d85112e16d678b39f868c24155
Showing with 33 additions and 34 deletions.
  1. +33 −34 doc/git_tips.txt
View
@@ -1,52 +1,51 @@
-
-Pushing your code to mainstream or to your adva clone
-=====================================================
+Pushing your code to mainstream
+===============================
Here is quick way to push your code up:
- cd vendor/adva
- open .git/config
- change: url = git://github.com/svenfuchs/adva_cms.git
- to your adva clone: url = git@github.com:MY_GITHUB_USERNAME/adva_cms.git
- or to mainstream: url = git@github.com:svenfuchs/adva_cms.git
-
- then pushing up to the new location:
- git push origin master
+ cd vendor/adva # aka to your adva repo
+
+ # push to svenfuchs repo when you have direct commit right and
+ # please avoid merges in your git log
+ git push git://github.com/svenfuchs/adva_cms.git master:master
Git workflow to avoid merges
============================
- Usually git merges are not good indicator, often it means master branch is abused :-)
+ Usually git merges in log are not good indicator,
+ often it means you are doing merges instead of using rebase.
+
+ Here is priidu's workflow, what he currently thinks is the correct way of using git:
+
+ # first let's clone mainstream adva for example when you have right to commit
- Here is priit's workflow, what he thinks is the correct way of using git:
+ git clone git@github.com:svenfuchs/adva_cms.git
- master$ git pull master
- # NEVER to any changes at master, get habit to make branches on the
- fly however small task you have (you NEVER know if someone has pushed
- something to master meantime etc)
+ # When cloning you have got master and origin/master branches.
+ # Now make your changes to your master branch.
- master$ git checkout newsletter
+ touch test_clean_rebase
+ git add .
+ git commit -va
- newsletter$ git rebase master
- # rebase is important to update your branch with master, don't use
- # merge (it pollute to much log file)
+ # Write your comment and you have successfully commited to your local master branch
- # coding...
- # when I'm done with my feature
+ # Meanwhile when you wrote new code, others have pushed to mainline adva branch, so
+ # before pushing you need to fetch and rebase. Please do not use pull here, cos
+ # it will pollute log with unneeded merges.
+ # Therefore, first let's fetch most recent code from svenfuchs/adva_cms.
- newsletter$ git add ...your files
- newsletter$ git commit ...your files
+ git fetch origin
- newsletter$ git chechkout master
- master$ git pull # so I can update to master and see what's new
+ # Now svenfuchs/adva_cms named "origin" in your repo has been fetched to your origin/master branch.
+ # Now it's time to rebase origin/master to your own master branch.
- master$ git checkout newsletter
- newsletter$ git rebase master
+ git rebase origin/master
- # NOW i run tests, if everything is ok then I merge (now git makes it fast forward way)
- newsletter$ git checkout master
- master$ git merge newsletter
- master$ git push origin master
+ # If you have any conflicts now, you just fix them manually and commit fixes and continue rebase.
+ # After when "git status" shows clean status you are ready to push to svenfuchs/master branch.
- I hope it helps for everyone use git.
+ git push # or: git push origin master:master
+ # Done.
+ # I hope this short howto will helps new people to use git well without merges in log.

0 comments on commit f32263a

Please sign in to comment.