Changes from Version 1 of GitHowto

Show
Ignore:
Author:
skvidal (IP: 98.122.166.39)
Timestamp:
03/09/09 19:36:28 (9 years ago)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GitHowto

    v0 v1  
     1= Howto use git with yum = 
     2This page contains common git usage commands for working on the git repository. 
     3 
     4 
     5== Checkout yum-utils repository == 
     6This will checkout the yum utils repository 
     7{{{ 
     8git clone ssh://yum.baseurl.org/srv/projects/yum/git/yum-utils.git 
     9cd yum-utils 
     10}}} 
     11 
     12== Daily usage == 
     13 
     14==== Get updates from remote repository ==== 
     15{{{ 
     16git pull 
     17}}} 
     18If you have made unpublished changes to your local branch since last '''git pull''' 
     19then use these commands instead to avoid Merge messages in the log 
     20{{{ 
     21git fetch 
     22git rebase origin 
     23}}} 
     24 
     25==== Commit changed files (locally) ==== 
     26{{{ 
     27git commit -a 
     28}}} 
     29OR 
     30{{{ 
     31git commit -a -m "Commit message" 
     32}}} 
     33 
     34==== Push changes to remote repository ==== 
     35{{{ 
     36git push 
     37}}} 
     38=== Add new file === 
     39{{{ 
     40git add file 
     41}}} 
     42 
     43== Work with branches == 
     44 
     45=== Show local branches === 
     46{{{ 
     47git branch 
     48}}} 
     49 
     50=== Show remote branches === 
     51{{{ 
     52git branch -r 
     53}}} 
     54 
     55=== Create a local branch tracking remote branch === 
     56Create a local '''yum-utils-1_0_X''' branch tracking the remote '''origin/yum-utils-1_0_X''' branch and switch to the '''yum-utils-1_0_X''' 
     57{{{ 
     58git checkout –track -b yum-utils-1_0_X origin/yum-utils-1_0_X 
     59}}} 
     60 
     61=== Switch to another local branch === 
     62Switch to the '''yum-utils-1_0_X''' branch 
     63{{{ 
     64git checkout yum-utils-1_0_X 
     65}}} 
     66 
     67When you have changed to a local branch there is tracking a remote branch all the '''daily usage''' commands 
     68will work on that branch. 
     69 
     70=== Switch back to master branch === 
     71{{{ 
     72git checkout master 
     73}}} 
     74 
     75=== Create a local branch & switch to the branch === 
     76{{{ 
     77 git checkout -b branchname 
     78}}} 
     79 
     80=== Change to local branch === 
     81{{{ 
     82 git checkout branchname 
     83}}} 
     84 
     85=== Push local branch up to public repository === 
     86{{{ 
     87 git push origin branchname 
     88}}} 
     89  Yes, this is backward as hell. 
     90 
     91== Created a patch with changes from a local branch to master == 
     92{{{ 
     93git checkout mylocalbranch 
     94git diff -p master -- . > my-patch.txt 
     95}}} 
     96 
     97== Apply a patch to current local branch == 
     98{{{ 
     99git apply my-patch.txt 
     100}}} 
     101 
     102=== Set a tag for a release === 
     103{{{ 
     104git tag -a tagname 
     105git push --tags 
     106}}}