Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
git:quick-start-guide [2008/11/27 14:21]
andrei
git:quick-start-guide [2009/04/23 11:30]
andrei added note about autosetuprebase
Line 6: Line 6:
 ===== GIT URLs ===== ===== GIT URLs =====
  
-  * git://git.sip-router.org/sip-router - (read only) +  * %%git://git.sip-router.org/sip-router%% - (read only) 
-  * http://git.sip-router.org/sip-router - (read only, slower, git://... recommended) +  * http://git.sip-router.org/sip-router - (read only, slower, %%git://...%% recommended) 
-  * ssh://git.sip-router.org/sip-router - (read/write, developer account needed on git.sip-router.org)+  * %%ssh://git.sip-router.org/sip-router%% - (read/write, developer account needed on git.sip-router.org)
  
  
Line 14: Line 14:
  
   * http://git.sip-router.org/cgi-bin/gitweb.cgi   * http://git.sip-router.org/cgi-bin/gitweb.cgi
- 
- 
 ===== First config options ===== ===== First config options =====
    
Line 21: Line 19:
   * First of all, set your name and email address:   * First of all, set your name and email address:
 <code> <code>
-git config --global user.name \'your_name\+git config --global user.name 'your_name' 
-git config --global user.email \'your email address\'+git config --global user.email 'your email address'
 </code> </code>
  
- Some other recommended git config setting: +Some other recommended git config setting: 
-   * include summaries of merged commits in commit merge messages (a MUST)+ 
 +   * include summaries of merged commits in commit merge messages (a **MUST**)
 <code> <code>
 git config --global merge.log true git config --global merge.log true
Line 35: Line 34:
 git config --global branch.autosetupmerge always git config --global branch.autosetupmerge always
 </code> </code>
- +   * by default perform a rebase instead of a merge when pulling into the local master branch (highly recommended, it gets rid of lot of confusing merge origin/master messages). It's equivalent to adding **--rebase** to git pull command line. (**recommended**)
- +
-===== GIT merge into master howto ===== +
- +
- * if you don\'t have local **master** branch tracking **origin/master** (git branch|grep master is empty)+
 <code> <code>
-git checkout --track -b master origin/master+git config branch.master.rebase true
 </code> </code>
- +   by default setup all new local branches to perform rebase (like above) when pull-ing (so that you don'have to run //git config branch.%%<branchname>%%.rebase true// for each of them).
-  if you already have a local **master** branch tracking **origin/master**+
 <code> <code>
-git checkout master +git config branch.autosetuprebase always  # or remote 
-git merge --log origin/branch_to_merge # for older git versionmake sure merge.summary is true and skip --log +</code> 
-git log -1 # make sure you see a correct merge message (with summary), if not abort +   * (**not recommended**) by default use --no-ff when merging into master (this means that a merge commit message will be generated for all merges; without it fast-forward merges will not generate a merge message). **Note**: --no-ff will generate merge logs even when updating master from origin (git pull origin master)which is not what you wantYou should either use "-**-no-ff**" by default like described below, but then make sure to add "**--ff**" every time you update your local master version (git pull **--ff** origin master), or you don't use it, but then always remember to add "-**-no-ff**" when merging some other branch into master (e.g.: git merge **--no-ff** origin/foo). 
-gitk optionallook if the commit tree looks ok +<code> 
-only if everything is ok and you looked at the log +_not_ recommendeduse _only_ if you do a _lot_ of merges between public 
-git push origin master:master +branches (see Note: above), otherwise you're better off without it 
 +git config branch.master.mergeoptions  "--no-ff"
 </code> </code>
  
-  * if you did something wrong and pushed, and it cannot be easily corrected by a git revert, send an email to sr-dev@lists.sip-router.org asking to revert master to the previous state (this should be avoided in general since it would cause extra work for all people who fetched or pulled master in the meantime)+===== GIT commit into master howto =====
  
-  * if you need to abort or undo a merge attempt, you don\'t have any local changes that you want to keep and you haven\'t pushed back to origin (if you did, see above), use: +Please see [[git:commit-into-master|GIT commit into master howto]] 
-<code> + 
-git reset --hard ORIG_HEAD  # WARNING: all local changes to the current branch will be lost +===== GIT merge into master howto =====
-</code>+
  
-  * don\'t try to merge the reverse way, e.g.git checkout my_branch; git merge master; git push origin my_branch:master. The merge is equivalent to the above one (from the code point of view), but the merge commit message will be wrong.+Please see [[git:merge-into-master|GIT merge into master howto]]

Navigation

Wiki

Other

QR Code
QR Code git:quick-start-guide (generated for current page)