You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

239 lines
6.6KB

  1. About Git write access:
  2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3. Before everything else, you should know how to use GIT properly.
  4. Luckily Git comes with excellent documentation.
  5. git --help
  6. man git
  7. shows you the available subcommands,
  8. git <command> --help
  9. man git-<command>
  10. shows information about the subcommand <command>.
  11. The most comprehensive manual is the website Git Reference
  12. http://gitref.org/
  13. For more information about the Git project, visit
  14. http://git-scm.com/
  15. Consult these resources whenever you have problems, they are quite exhaustive.
  16. You do not need a special username or password.
  17. All you need is to provide a ssh public key to the Git server admin.
  18. What follows now is a basic introduction to Git and some FFmpeg-specific
  19. guidelines. Read it at least once, if you are granted commit privileges to the
  20. FFmpeg project you are expected to be familiar with these rules.
  21. I. BASICS:
  22. ==========
  23. 0. Get GIT:
  24. You can get git from http://git-scm.com/
  25. 1. Cloning the source tree:
  26. git clone git://git.videolan.org/ffmpeg <target>
  27. This will put the FFmpeg sources into the directory <target>.
  28. git clone git@git.videolan.org:ffmpeg <target>
  29. This will put the FFmpeg sources into the directory <target> and let
  30. you push back your changes to the remote repository.
  31. 2. Updating the source tree to the latest revision:
  32. git pull
  33. pulls in the latest changes from the repository to your local master branch.
  34. 2.a Rebasing your local branches:
  35. git pull --rebase
  36. fetches the changes from the main repository and replays your local commits
  37. over it. This is useful to keep all your local changes at the top of your
  38. tree.
  39. 3. Adding/removing files/directories:
  40. git add [-A] <filename/dirname>
  41. git rm [-r] <filename/dirname>
  42. GIT needs to get notified of all changes you make to your working
  43. directory that makes files appear or disappear.
  44. Line moves across files are automatically tracked.
  45. 4. Showing modifications:
  46. git diff <filename(s)>
  47. will show all local modifications in your working directory as unified diff.
  48. 5. Inspecting the changelog:
  49. git log <filename(s)>
  50. You may also use the graphical tools like gitview or gitk or the web
  51. interface available at http://git.videolan.org
  52. 6. Checking source tree status:
  53. git status
  54. detects all the changes you made and lists what actions will be taken in case
  55. of a commit (additions, modifications, deletions, etc.).
  56. 7. Committing:
  57. git diff --check
  58. to doublecheck your changes before committing them to avoid trouble later
  59. on. All experienced developers do this on each and every commit, no matter
  60. how small.
  61. Every one of them has been saved from looking like a fool by this many times.
  62. It's very easy for stray debug output or cosmetic modifications to slip in,
  63. please avoid problems through this extra level of scrutiny.
  64. For cosmetics-only commits you should get (almost) empty output from
  65. git diff -wb <filename(s)>
  66. Also check the output of
  67. git status
  68. to make sure you don't have untracked files or deletions.
  69. git add [-i|-p|-A] <filenames/dirnames>
  70. Git will select the changes to the files for commit. Optionally you can use
  71. the interactive or the patch mode to select hunk by hunk what should be
  72. added to the commit.
  73. git commit
  74. Git will commit the selected changes to your current local branch.
  75. You will be prompted for a log message in an editor, which is either
  76. set in your personal configuration file throught
  77. git config core.editor
  78. or set by one of the following environment variables:
  79. GIT_EDITOR, VISUAL or EDITOR.
  80. Log messages should be concise but descriptive. Explain why you made a change,
  81. what you did will be obvious from the changes themselves most of the time.
  82. Saying just "bug fix" or "10l" is bad. Remember that people of varying skill
  83. levels look at and educate themselves while reading through your code. Don't
  84. include filenames in log messages, Git provides that information.
  85. Possibly make the commit message have a terse, descriptive first line, an
  86. empty line and then a full description. The first line will be used to name
  87. the patch by git format-patch.
  88. 8. Renaming/moving/copying files or contents of files:
  89. Git automatically tracks such changes, making those normal commits.
  90. mv/cp path/file otherpath/otherfile
  91. git add [-A] .
  92. git commit
  93. Do not move, rename or copy files of which you are not the maintainer without
  94. discussing it on the mailing list first!
  95. 9. Reverting broken commits
  96. git revert <commit>
  97. git revert will generate a revert commit. This will not make the faulty
  98. commit disappear from the history.
  99. git reset <commit>
  100. git reset will uncommit the changes till <commit> rewriting the current
  101. branch history.
  102. git commit --amend
  103. allows to amend the last commit details quickly.
  104. git rebase -i origin/master
  105. will replay local commits over the main repository allowing to edit,
  106. merge or remove some of them in the process.
  107. Note that the reset, commit --amend and rebase rewrite history, so you
  108. should use them ONLY on your local or topic branches.
  109. The main repository will reject those changes.
  110. 10. Preparing a patchset.
  111. git format-patch <commit> [-o directory]
  112. will generate a set of patches out of the current branch starting from
  113. commit. By default the patches are created in the current directory.
  114. 11. Sending patches for review
  115. git send-email <commit list|directory>
  116. will send the patches created by git format-patch or directly generates
  117. them. All the email fields can be configured in the global/local
  118. configuration or overridden by command line.
  119. 12. Pushing changes to remote trees
  120. git push
  121. Will push the changes to the default remote (origin).
  122. Git will prevent you from pushing changes if the local and remote trees are
  123. out of sync. Refer to 2 and 2.a to sync the local tree.
  124. git remote add <name> <url>
  125. Will add additional remote with a name reference, it is useful if you want
  126. to push your local branch for review on a remote host.
  127. git push <remote> <refspec>
  128. Will push the changes to the remote repository. Omitting refspec makes git
  129. push update all the remote branches matching the local ones.
  130. 13. Finding a specific svn revision
  131. Since version 1.7.1 git supports ':/foo' syntax for specifying commits
  132. based on a regular expression. see man gitrevisions
  133. git show :/'as revision 23456'
  134. will show the svn changeset r23456. With older git versions searching in
  135. the git log output is the easiest option (especially if a pager with
  136. search capabilities is used).
  137. Contact the project admins <root at ffmpeg dot org> if you have technical
  138. problems with the GIT server.