-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathREADME
170 lines (106 loc) · 3.53 KB
/
README
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
##########
# BASICS #
##########
To make changes:
git add path/to/file1 path/to/file2
git commit -m "templates: Changed the XX template to do XX"
To push that to the central server (which makes it available for deployment):
git push
To revert a file to its state in the repository:
git checkout path/to/file_that_has_changed
To get the latest code changes:
git pull --rebase
#############################
# REMOTE BRANCHES: YOUR OWN #
#############################
We use remote tracking branches for branching.
To create a tracking branch called "ajax_fallback":
git checkout -b ajax_fallback
git push -u origin ajax_fallback
To push changes in this branch:
git push
If you get an error, pull the latest files, then try again:
git pull
git push
If, after that, you still get an error for "git push", pull on master, then
go back to the branch and try again:
git checkout master
git pull --rebase
# Try again.
git checkout ajax_fallback
git push
If, after that, you still get an error and the error message contains
"[rejected]", then find the branch name next to "[rejected]" and update it.
Then go back to the branch and try again.
git checkout branch_that_was_rejected
git pull
# Try again.
git checkout ajax_fallback
git push
To pull changes that other people have made to this branch (do not use rebase!):
git pull
To pull changes that have been made to master (do not use rebase!):
git merge master
git push
If you get an error for "git push", do a straight "git pull" WITHOUT "--rebase".
git pull
To see the full diff of what's changed in this branch:
git checkout master
git diff master ajax_fallback
When you're ready to merge the branch back into master:
# Double check the full diff of what changed.
git checkout master
git diff master ajax_fallback
# Merge it (keep in mind you're still in master).
git merge ajax_fallback
git push
# Delete the local and remote branches.
git branch -d ajax_fallback
git push origin :ajax_fallback
To delete a branch without merging it back into master:
git checkout master
git branch -D ajax_fallback
git push origin :ajax_fallback
###################################
# REMOTE BRANCHES: OTHER PEOPLE'S #
###################################
To check out the branch somebody else has created:
git checkout --track origin/ajax_fallback
To push changes in this branch:
git push
To pull changes that other people have made to this branch (do not use rebase!):
git pull
To pull changes that have been made to master (do not use rebase!):
git merge master
git push
To see the full diff of what's changed in this branch:
git checkout master
git diff master ajax_fallback
##################
# LOCAL BRANCHES #
##################
Generally all of our branches are remote, but if you want to create a local one,
a few things are different -- namely to use "git rebase master" when you pull
changes from master.
To create the branch:
git checkout -b ajax_fallback
To pull changes that have been made to master:
git rebase master
################
# VIEWING INFO #
################
To view which branch you're on:
git status
To view all branches, including remotes:
git branch -a
To view all branches, with information about whether they're tracking/remotes:
git remote show origin
################
# USEFUL LINKS #
################
GitHub Git cheat sheet
http://help.github.com/git-cheat-sheets/
Why do we use --rebase when pulling on master?
http://gitready.com/advanced/2009/02/11/pull-with-rebase.html
Remotes
http://progit.org/book/ch3-5.html