git

JSON

rev 18  |  foxhop  |  1376649657000  |  JSON

rev 17
rev 18
139139
140   git config --global core.editor "vim"140   git config --global core.editor "vim"
tt141 
142how to enable colorful diffs
143==================================
144 
145.. code-block:: bash
146 
147 git config --global color.ui true
148 
149 
rev 17  |  foxhop  |  1368971398000  |  JSON

rev 16
rev 17
tt1git notes
2#########
3 
4.. contents::
5 
6 
7 
1Set a local repo or global username8Set a local repo or global username
2=======================================9=======================================
rev 16  |  foxhop  |  1368971351000  |  JSON

rev 15
rev 16
123123
124    git push origin124    git push origin
tt125 
126 
127 
128how to set the git commit editor
129======================================
130 
131.. code-block:: bash
132 
133   git config --global core.editor "vim"
rev 15  |  foxhop  |  1367927767000  |  JSON

rev 14
rev 15
13================================13================================
1414
n15git push origin mastern15if this is your first commit/push:
1616
t17How to add upstream mastert17.. code-block:: bash
18 
19 git push origin master
20 
21else:
22 
23.. code-block:: bash
24 
25 git push
26 
27 
28 
29 
1830
1931
rev 14  |  foxhop  |  1363717921000  |  JSON

rev 13
rev 14
110   .. code-block:: bash110   .. code-block:: bash
111111
t112    git push origin developt112    git push origin
rev 13  |  foxhop  |  1363717693000  |  JSON

rev 12
rev 13
104   .. code-block:: bash104   .. code-block:: bash
105105
t106    git merge upstream/developt106    git pull upstream develop
107107
108#. push local to remote origin108#. push local to remote origin
rev 12  |  foxhop  |  1363696135000  |  JSON

rev 11
rev 12
100100
101 101 
n102#. get synced up withn102#. sync local with remote upstream
103103
104   .. code-block:: bash104   .. code-block:: bash
105105
t106    git merge upstream/mastert106    git merge upstream/develop
107 
108#. push local to remote origin
109 
110   .. code-block:: bash
111 
112    git push origin develop
rev 11  |  foxhop  |  1363695943000  |  JSON

rev 10
rev 11
77    git remote add upstream https://github.com/saltstack/salt.git77    git remote add upstream https://github.com/saltstack/salt.git
78    git fetch upstream78    git fetch upstream
n79     # should create a bunch more branches, to view:n79 
80#. view all branches
81 
82   .. code-block:: bash
83 
80    git branch -a84    git branch -a
8185
nn86    * develop
87     remotes/origin/0.11
88     remotes/origin/0.12
89     remotes/origin/0.13
90     remotes/origin/HEAD -> origin/develop
91     remotes/origin/develop
92     remotes/origin/master
93     remotes/origin/no_ipv6
94     remotes/upstream/0.11
95     remotes/upstream/0.12
96     remotes/upstream/0.13
97     remotes/upstream/develop
98     remotes/upstream/master
99     remotes/upstream/no_ipv6
82100
tt101 
102#. get synced up with
103 
104   .. code-block:: bash
105 
106    git merge upstream/master
rev 10  |  foxhop  |  1363695662000  |  JSON

rev 9
rev 10
7676
77    git remote add upstream https://github.com/saltstack/salt.git77    git remote add upstream https://github.com/saltstack/salt.git
tt78    git fetch upstream
79     # should create a bunch more branches, to view:
80    git branch -a
7881
7982
rev 9  |  foxhop  |  1363691663000  |  JSON

rev 8
rev 9
64#. perform a pull-request using github gui64#. perform a pull-request using github gui
6565
tt66|
67 
66Go to vacation for 1 week68Go on vacation for 1 week
67 Your local and origin repositories appear out-of-date.  Sync them by performing69 Your local and origin repos now appear out-of-date.  Sync them by performing a 
> a fast-forward or merge with upstream.>fast-forward or merge with upstream.
70 
71|
6872
69#. Tell your local repo about the upstream repo73#. Tell your local repo about the upstream repo
rev 8  |  foxhop  |  1363691244000  |  JSON

rev 7
rev 8
67 Your local and origin repositories appear out-of-date.  Sync them by performing67 Your local and origin repositories appear out-of-date.  Sync them by performing
> a fast-forward or merge with upstream.> a fast-forward or merge with upstream.
6868
nn69#. Tell your local repo about the upstream repo
6970
tt71   .. code-block:: bash
72 
73    git remote add upstream https://github.com/saltstack/salt.git
74 
75 
rev 7  |  foxhop  |  1363691062000  |  JSON

rev 6
rev 7
52    cd ~/git52    cd ~/git
53    git clone https://github.com/russellballestrini/salt.git53    git clone https://github.com/russellballestrini/salt.git
tt54    cd salt
55 
56#. make some changes to source code and push to remote origin (your github fork)
57   
58   .. code-block:: bash
59 
60    git add .
61    git commit
62    git push
63 
64#. perform a pull-request using github gui
65 
66Go to vacation for 1 week
67 Your local and origin repositories appear out-of-date.  Sync them by performing
 > a fast-forward or merge with upstream.
5468
5569
rev 6  |  foxhop  |  1363690339000  |  JSON

rev 5
rev 6
3838
39 pull changes from upstream, perform merges and fast forwards to keep sync'd39 pull changes from upstream, perform merges and fast forwards to keep sync'd
tt40 
41example using salt repo
42-------------------------------
43 
44#. create a remote fork on github
45 
46   press the fork button when logged in
47 
48#. clone the remote fork to your local host
49 
50   .. code-block:: bash
51 
52    cd ~/git
53    git clone https://github.com/russellballestrini/salt.git
54 
55 
rev 5  |  foxhop  |  1363690151000  |  JSON

rev 4
rev 5
n1Set local repo or global usernamen1Set a local repo or global username
2=======================================2=======================================
33
1414
15git push origin master15git push origin master
t16 t16 
17How to add upstream master
18 
19 
20 
21Basic github workflow
22============================
23 
24upstream
25 original remote github repo, read-only
26 
27 only way to change this repo is to ask for a merge using a pull-request
28 
29origin
30 forked remote github repo, read-write
31 
32 push you changes here and perform pull requests 
33 
34local
35 cloned local, read-write
36 
37 make changes and push to origin 
38 
39 pull changes from upstream, perform merges and fast forwards to keep sync'd
rev 4  |  foxhop  |  1351856190000  |  JSON

rev 3
rev 4
9 git config --global user.name "foxhop"9 git config --global user.name "foxhop"
10 git config --global user.email "foxhop@foxhop.net"10 git config --global user.email "foxhop@foxhop.net"
tt11 
12How to push to remote master
13================================
14 
15git push origin master
11 16 
rev 3  |  foxhop  |  1351855338000  |  JSON

rev 2
rev 3
55
6 git config --local user.name "fox"6 git config --local user.name "fox"
nn7 git config --local user.email "fox@localhost" 
8 
7 git config --global user.name "foxhop"9 git config --global user.name "foxhop"
tt10 git config --global user.email "foxhop@foxhop.net"
11 
rev 2  |  foxhop  |  1351855175000  |  JSON

rev 1
rev 2
2=======================================2=======================================
33
tt4.. code-block:: bash
5 
4git config --local user.name "fox"6 git config --local user.name "fox"
5git config --global user.name "foxhop"7 git config --global user.name "foxhop"
rev 1  |  foxhop  |  1351855141000  |  JSON

empty
rev 1
tt1Set local repo or global username
2=======================================
3 
4git config --local user.name "fox"
5git config --global user.name "foxhop"