2 About Git write access:
3 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 Before everything else, you should know how to use GIT properly.
6 Luckily Git comes with excellent documentation.
11 shows you the available subcommands,
16 shows information about the subcommand <command>.
18 The most comprehensive manual is the website Git Reference
22 For more information about the Git project, visit
26 Consult these resources whenever you have problems, they are quite exhaustive.
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.
31 What follows now is a basic introduction to Git and some FFmpeg-specific
32 guidelines. Read it at least once, if you are granted commit privileges to the
33 FFmpeg project you are expected to be familiar with these rules.
42 You can get git from http://git-scm.com/
45 1. Cloning the source tree:
47 git clone git://git.videolan.org/ffmpeg <target>
49 This will put the FFmpeg sources into the directory <target>.
51 git clone git@git.videolan.org:ffmpeg <target>
53 This will put the FFmpeg sources into the directory <target> and let
54 you push back your changes to the remote repository.
57 2. Updating the source tree to the latest revision:
61 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
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.
69 2.a Rebasing your local branches:
73 fetches the changes from the main repository and replays your local commits
74 over it. This is required to keep all your local changes at the top of
75 FFmpeg's master tree. The master tree will reject pushes with merge commits.
78 3. Adding/removing files/directories:
80 git add [-A] <filename/dirname>
81 git rm [-r] <filename/dirname>
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.
88 4. Showing modifications:
90 git diff <filename(s)>
92 will show all local modifications in your working directory as unified diff.
95 5. Inspecting the changelog:
99 You may also use the graphical tools like gitview or gitk or the web
100 interface available at http://git.videolan.org
102 6. Checking source tree status:
106 detects all the changes you made and lists what actions will be taken in case
107 of a commit (additions, modifications, deletions, etc.).
114 to double check your changes before committing them to avoid trouble later
115 on. All experienced developers do this on each and every commit, no matter
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.
121 For cosmetics-only commits you should get (almost) empty output from
123 git diff -wb <filename(s)>
125 Also check the output of
129 to make sure you don't have untracked files or deletions.
131 git add [-i|-p|-A] <filenames/dirnames>
133 Git will select the changes to the files for commit. Optionally you can use
134 the interactive or the patch mode to select hunk by hunk what should be
139 Git will commit the selected changes to your current local branch.
141 You will be prompted for a log message in an editor, which is either
142 set in your personal configuration file through
144 git config core.editor
146 or set by one of the following environment variables:
147 GIT_EDITOR, VISUAL or EDITOR.
149 Log messages should be concise but descriptive. Explain why you made a change,
150 what you did will be obvious from the changes themselves most of the time.
151 Saying just "bug fix" or "10l" is bad. Remember that people of varying skill
152 levels look at and educate themselves while reading through your code. Don't
153 include filenames in log messages, Git provides that information.
155 Possibly make the commit message have a terse, descriptive first line, an
156 empty line and then a full description. The first line will be used to name
157 the patch by git format-patch.
160 8. Renaming/moving/copying files or contents of files:
162 Git automatically tracks such changes, making those normal commits.
164 mv/cp path/file otherpath/otherfile
170 Do not move, rename or copy files of which you are not the maintainer without
171 discussing it on the mailing list first!
173 9. Reverting broken commits
177 git revert will generate a revert commit. This will not make the faulty
178 commit disappear from the history.
182 git reset will uncommit the changes till <commit> rewriting the current
187 allows to amend the last commit details quickly.
189 git rebase -i origin/master
191 will replay local commits over the main repository allowing to edit,
192 merge or remove some of them in the process.
194 Note that the reset, commit --amend and rebase rewrite history, so you
195 should use them ONLY on your local or topic branches.
197 The main repository will reject those changes.
199 10. Preparing a patchset.
201 git format-patch <commit> [-o directory]
203 will generate a set of patches out of the current branch starting from
204 commit. By default the patches are created in the current directory.
206 11. Sending patches for review
208 git send-email <commit list|directory>
210 will send the patches created by git format-patch or directly generates
211 them. All the email fields can be configured in the global/local
212 configuration or overridden by command line.
214 12. Pushing changes to remote trees
218 Will push the changes to the default remote (origin).
219 Git will prevent you from pushing changes if the local and remote trees are
220 out of sync. Refer to 2 and 2.a to sync the local tree.
222 git remote add <name> <url>
224 Will add additional remote with a name reference, it is useful if you want
225 to push your local branch for review on a remote host.
227 git push <remote> <refspec>
229 Will push the changes to the remote repository. Omitting refspec makes git
230 push update all the remote branches matching the local ones.
232 13. Finding a specific svn revision
234 Since version 1.7.1 git supports ':/foo' syntax for specifying commits
235 based on a regular expression. see man gitrevisions
237 git show :/'as revision 23456'
239 will show the svn changeset r23456. With older git versions searching in
240 the git log output is the easiest option (especially if a pager with
241 search capabilities is used).
242 This commit can be checked out with
244 git checkout -b svn_23456 :/'as revision 23456'
246 or for git < 1.7.1 with
248 git checkout -b svn_23456 $SHA1
250 where $SHA1 is the commit SHA1 from the 'git log' output.
253 Contact the project admins <root at ffmpeg dot org> if you have technical
254 problems with the GIT server.