annotate ffmpeg/doc/git-howto.txt @ 13:844d341cf643 tip

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