Statistics
| Branch: | Revision:

ffmpeg / doc / git-howto.txt @ c6c2dfcf

History | View | Annotate | Download (7.53 KB)

1 df17f6d5 Anton Khirnov
2
About Git write access:
3
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
5
Before everything else, you should know how to use GIT properly.
6
Luckily Git comes with excellent documentation.
7
8
  git --help
9
  man git
10
11
shows you the available subcommands,
12
13
  git <command> --help
14
  man git-<command>
15
16
shows information about the subcommand <command>.
17
18
The most comprehensive manual is the website Git Reference
19
20
http://gitref.org/
21
22
For more information about the Git project, visit
23
24
http://git-scm.com/
25
26
Consult these resources whenever you have problems, they are quite exhaustive.
27
28
You do not need a special username or password.
29
All you need is to provide a ssh public key to the Git server admin.
30
31 f8a45fa1 Janne Grunau
What follows now is a basic introduction to Git and some Libav-specific
32 df17f6d5 Anton Khirnov
guidelines. Read it at least once, if you are granted commit privileges to the
33 f8a45fa1 Janne Grunau
Libav project you are expected to be familiar with these rules.
34 df17f6d5 Anton Khirnov
35
36
37
I. BASICS:
38
==========
39
40
0. Get GIT:
41
42
  You can get git from http://git-scm.com/
43
44
45
1. Cloning the source tree:
46
47 21de9204 Johan Andersson
    git clone git://git.libav.org/libav.git <target>
48 df17f6d5 Anton Khirnov
49 f8a45fa1 Janne Grunau
  This will put the Libav sources into the directory <target>.
50 df17f6d5 Anton Khirnov
51 21de9204 Johan Andersson
    git clone git@git.libav.org:libav.git <target>
52 df17f6d5 Anton Khirnov
53 f8a45fa1 Janne Grunau
  This will put the Libav sources into the directory <target> and let
54 df17f6d5 Anton Khirnov
  you push back your changes to the remote repository.
55
56
57
2. Updating the source tree to the latest revision:
58
59 ffe9fd25 Janne Grunau
    git pull (--ff-only)
60 df17f6d5 Anton Khirnov
61 ffe9fd25 Janne Grunau
  pulls in the latest changes from the tracked branch. The tracked branch
62
  can be remote. By default the master branch tracks the branch master in
63
  the remote origin.
64
  Caveat: Since merge commits are forbidden at least for the initial
65
          months of git --ff-only or --rebase (see below) are recommended.
66
          --ff-only will fail and not create merge commits if your branch
67
          has diverged (has a different history) from the tracked branch.
68 df17f6d5 Anton Khirnov
69
2.a Rebasing your local branches:
70
71
    git pull --rebase
72
73
  fetches the changes from the main repository and replays your local commits
74 ffe9fd25 Janne Grunau
  over it. This is required to keep all your local changes at the top of
75 f8a45fa1 Janne Grunau
  Libav's master tree. The master tree will reject pushes with merge commits.
76 df17f6d5 Anton Khirnov
77
78
3. Adding/removing files/directories:
79
80
    git add [-A] <filename/dirname>
81
    git rm [-r] <filename/dirname>
82
83
  GIT needs to get notified of all changes you make to your working
84
  directory that makes files appear or disappear.
85
  Line moves across files are automatically tracked.
86
87
88
4. Showing modifications:
89
90
    git diff <filename(s)>
91
92
  will show all local modifications in your working directory as unified diff.
93
94
95
5. Inspecting the changelog:
96
97
    git log <filename(s)>
98
99
  You may also use the graphical tools like gitview or gitk or the web
100 21de9204 Johan Andersson
  interface available at http://git.libav.org/
101 df17f6d5 Anton Khirnov
102
6. Checking source tree status:
103
104
    git status
105
106
  detects all the changes you made and lists what actions will be taken in case
107
  of a commit (additions, modifications, deletions, etc.).
108
109
110
7. Committing:
111
112
    git diff --check
113
114 5fbf2b3f Alex Converse
  to double check your changes before committing them to avoid trouble later
115 df17f6d5 Anton Khirnov
  on. All experienced developers do this on each and every commit, no matter
116
  how small.
117
  Every one of them has been saved from looking like a fool by this many times.
118
  It's very easy for stray debug output or cosmetic modifications to slip in,
119
  please avoid problems through this extra level of scrutiny.
120
121
  For cosmetics-only commits you should get (almost) empty output from
122
123
    git diff -wb <filename(s)>
124
125
  Also check the output of
126
127
    git status
128
129
  to make sure you don't have untracked files or deletions.
130
131
    git add [-i|-p|-A] <filenames/dirnames>
132
133 4aaeabcb Reimar Döffinger
  Make sure you have told git your name and email address, e.g. by running
134
    git config --global user.name "My Name"
135
    git config --global user.email my@email.invalid
136
  (--global to set the global configuration for all your git checkouts).
137
138 df17f6d5 Anton Khirnov
  Git will select the changes to the files for commit. Optionally you can use
139
  the interactive or the patch mode to select hunk by hunk what should be
140
  added to the commit.
141
142
    git commit
143
144
  Git will commit the selected changes to your current local branch.
145
146
  You will be prompted for a log message in an editor, which is either
147 5fbf2b3f Alex Converse
  set in your personal configuration file through
148 df17f6d5 Anton Khirnov
149
    git config core.editor
150
151
  or set by one of the following environment variables:
152
  GIT_EDITOR, VISUAL or EDITOR.
153
154
  Log messages should be concise but descriptive. Explain why you made a change,
155
  what you did will be obvious from the changes themselves most of the time.
156
  Saying just "bug fix" or "10l" is bad. Remember that people of varying skill
157
  levels look at and educate themselves while reading through your code. Don't
158
  include filenames in log messages, Git provides that information.
159
160
  Possibly make the commit message have a terse, descriptive first line, an
161
  empty line and then a full description. The first line will be used to name
162
  the patch by git format-patch.
163
164
165
8. Renaming/moving/copying files or contents of files:
166
167
  Git automatically tracks such changes, making those normal commits.
168
169
    mv/cp path/file otherpath/otherfile
170
171
    git add [-A] .
172
173
    git commit
174
175
  Do not move, rename or copy files of which you are not the maintainer without
176
  discussing it on the mailing list first!
177
178
9. Reverting broken commits
179
180
    git revert <commit>
181
182
  git revert will generate a revert commit. This will not make the faulty
183
  commit disappear from the history.
184
185
    git reset <commit>
186
187
  git reset will uncommit the changes till <commit> rewriting the current
188
  branch history.
189
190
    git commit --amend
191
192
  allows to amend the last commit details quickly.
193
194
    git rebase -i origin/master
195
196
  will replay local commits over the main repository allowing to edit,
197
  merge or remove some of them in the process.
198
199
  Note that the reset, commit --amend and rebase rewrite history, so you
200
  should use them ONLY on your local or topic branches.
201
202
  The main repository will reject those changes.
203
204
10. Preparing a patchset.
205
206
    git format-patch <commit> [-o directory]
207
208
  will generate a set of patches out of the current branch starting from
209
  commit. By default the patches are created in the current directory.
210
211
11. Sending patches for review
212
213
    git send-email <commit list|directory>
214
215
  will send the patches created by git format-patch or directly generates
216
  them. All the email fields can be configured in the global/local
217
  configuration or overridden by command line.
218
219
12. Pushing changes to remote trees
220
221
    git push
222
223
  Will push the changes to the default remote (origin).
224
  Git will prevent you from pushing changes if the local and remote trees are
225
  out of sync. Refer to 2 and 2.a to sync the local tree.
226
227
    git remote add <name> <url>
228
229
  Will add additional remote with a name reference, it is useful if you want
230
  to push your local branch for review on a remote host.
231
232
    git push <remote> <refspec>
233
234
  Will push the changes to the remote repository. Omitting refspec makes git
235
  push update all the remote branches matching the local ones.
236
237 adb8669c Janne Grunau
13. Finding a specific svn revision
238 30876e39 Janne Grunau
239
  Since version 1.7.1 git supports ':/foo' syntax for specifying commits
240
  based on a regular expression. see man gitrevisions
241
242
    git show :/'as revision 23456'
243
244
  will show the svn changeset r23456. With older git versions searching in
245
  the git log output is the easiest option (especially if a pager with
246
  search capabilities is used).
247 a1c68a43 Janne Grunau
  This commit can be checked out with
248
249
    git checkout -b svn_23456 :/'as revision 23456'
250
251
  or for git < 1.7.1 with
252
253
    git checkout -b svn_23456 $SHA1
254
255
  where $SHA1 is the commit SHA1 from the 'git log' output.
256
257 30876e39 Janne Grunau
258 21de9204 Johan Andersson
Contact the project admins <git at libav dot org> if you have technical
259 df17f6d5 Anton Khirnov
problems with the GIT server.