git-howto.html 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Created by , GNU Texinfo 7.1.1 -->
  4. <head>
  5. <meta charset="utf-8">
  6. <title>
  7. Using Git to develop FFmpeg
  8. </title>
  9. <meta name="viewport" content="width=device-width,initial-scale=1.0">
  10. <link rel="stylesheet" type="text/css" href="bootstrap.min.css">
  11. <link rel="stylesheet" type="text/css" href="style.min.css">
  12. </head>
  13. <body>
  14. <div class="container">
  15. <h1>
  16. Using Git to develop FFmpeg
  17. </h1>
  18. <a name="SEC_Top"></a>
  19. <div class="element-contents" id="SEC_Contents">
  20. <h2 class="contents-heading">Table of Contents</h2>
  21. <div class="contents">
  22. <ul class="toc-numbered-mark">
  23. <li><a id="toc-Introduction" href="#Introduction">1 Introduction</a></li>
  24. <li><a id="toc-Basics-Usage" href="#Basics-Usage">2 Basics Usage</a>
  25. <ul class="toc-numbered-mark">
  26. <li><a id="toc-Get-Git" href="#Get-Git">2.1 Get Git</a></li>
  27. <li><a id="toc-Cloning-the-source-tree" href="#Cloning-the-source-tree">2.2 Cloning the source tree</a></li>
  28. <li><a id="toc-Updating-the-source-tree-to-the-latest-revision-1" href="#Updating-the-source-tree-to-the-latest-revision-1">2.3 Updating the source tree to the latest revision</a></li>
  29. <li><a id="toc-Rebasing-your-local-branches" href="#Rebasing-your-local-branches">2.4 Rebasing your local branches</a></li>
  30. <li><a id="toc-Adding_002fremoving-files_002fdirectories" href="#Adding_002fremoving-files_002fdirectories">2.5 Adding/removing files/directories</a></li>
  31. <li><a id="toc-Showing-modifications" href="#Showing-modifications">2.6 Showing modifications</a></li>
  32. <li><a id="toc-Inspecting-the-changelog" href="#Inspecting-the-changelog">2.7 Inspecting the changelog</a></li>
  33. <li><a id="toc-Checking-source-tree-status" href="#Checking-source-tree-status">2.8 Checking source tree status</a></li>
  34. <li><a id="toc-Committing" href="#Committing">2.9 Committing</a></li>
  35. <li><a id="toc-Writing-a-commit-message" href="#Writing-a-commit-message">2.10 Writing a commit message</a></li>
  36. <li><a id="toc-Preparing-a-patchset" href="#Preparing-a-patchset">2.11 Preparing a patchset</a></li>
  37. <li><a id="toc-Sending-patches-for-review" href="#Sending-patches-for-review">2.12 Sending patches for review</a></li>
  38. <li><a id="toc-Renaming_002fmoving_002fcopying-files-or-contents-of-files" href="#Renaming_002fmoving_002fcopying-files-or-contents-of-files">2.13 Renaming/moving/copying files or contents of files</a></li>
  39. </ul></li>
  40. <li><a id="toc-Git-configuration" href="#Git-configuration">3 Git configuration</a>
  41. <ul class="toc-numbered-mark">
  42. <li><a id="toc-Personal-Git-installation" href="#Personal-Git-installation">3.1 Personal Git installation</a></li>
  43. <li><a id="toc-Repository-configuration" href="#Repository-configuration">3.2 Repository configuration</a></li>
  44. </ul></li>
  45. <li><a id="toc-FFmpeg-specific" href="#FFmpeg-specific">4 FFmpeg specific</a>
  46. <ul class="toc-numbered-mark">
  47. <li><a id="toc-Reverting-broken-commits" href="#Reverting-broken-commits">4.1 Reverting broken commits</a></li>
  48. <li><a id="toc-Pushing-changes-to-remote-trees" href="#Pushing-changes-to-remote-trees">4.2 Pushing changes to remote trees</a></li>
  49. <li><a id="toc-Finding-a-specific-svn-revision" href="#Finding-a-specific-svn-revision">4.3 Finding a specific svn revision</a></li>
  50. </ul></li>
  51. <li><a id="toc-gpg-key-generation" href="#gpg-key-generation">5 gpg key generation</a></li>
  52. <li><a id="toc-Pre_002dpush-checklist" href="#Pre_002dpush-checklist">6 Pre-push checklist</a></li>
  53. <li><a id="toc-Server-Issues" href="#Server-Issues">7 Server Issues</a></li>
  54. </ul>
  55. </div>
  56. </div>
  57. <a name="Introduction"></a>
  58. <h2 class="chapter">1 Introduction<span class="pull-right"><a class="anchor hidden-xs" href="#Introduction" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Introduction" aria-hidden="true">TOC</a></span></h2>
  59. <p>This document aims in giving some quick references on a set of useful Git
  60. commands. You should always use the extensive and detailed documentation
  61. provided directly by Git:
  62. </p>
  63. <div class="example">
  64. <pre class="example-preformatted">git --help
  65. man git
  66. </pre></div>
  67. <p>shows you the available subcommands,
  68. </p>
  69. <div class="example">
  70. <pre class="example-preformatted">git &lt;command&gt; --help
  71. man git-&lt;command&gt;
  72. </pre></div>
  73. <p>shows information about the subcommand &lt;command&gt;.
  74. </p>
  75. <p>Additional information could be found on the
  76. <a class="url" href="http://gitref.org">Git Reference</a> website.
  77. </p>
  78. <p>For more information about the Git project, visit the
  79. <a class="url" href="http://git-scm.com/">Git website</a>.
  80. </p>
  81. <p>Consult these resources whenever you have problems, they are quite exhaustive.
  82. </p>
  83. <p>What follows now is a basic introduction to Git and some FFmpeg-specific
  84. guidelines to ease the contribution to the project.
  85. </p>
  86. <a name="Basics-Usage"></a>
  87. <h2 class="chapter">2 Basics Usage<span class="pull-right"><a class="anchor hidden-xs" href="#Basics-Usage" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Basics-Usage" aria-hidden="true">TOC</a></span></h2>
  88. <a name="Get-Git"></a>
  89. <h3 class="section">2.1 Get Git<span class="pull-right"><a class="anchor hidden-xs" href="#Get-Git" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Get-Git" aria-hidden="true">TOC</a></span></h3>
  90. <p>You can get Git from <a class="url" href="http://git-scm.com/">http://git-scm.com/</a>
  91. Most distribution and operating system provide a package for it.
  92. </p>
  93. <a name="Cloning-the-source-tree"></a>
  94. <h3 class="section">2.2 Cloning the source tree<span class="pull-right"><a class="anchor hidden-xs" href="#Cloning-the-source-tree" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Cloning-the-source-tree" aria-hidden="true">TOC</a></span></h3>
  95. <div class="example">
  96. <pre class="example-preformatted">git clone https://git.ffmpeg.org/ffmpeg.git &lt;target&gt;
  97. </pre></div>
  98. <p>This will put the FFmpeg sources into the directory <var class="var">&lt;target&gt;</var>.
  99. </p>
  100. <div class="example">
  101. <pre class="example-preformatted">git clone git@source.ffmpeg.org:ffmpeg &lt;target&gt;
  102. </pre></div>
  103. <p>This will put the FFmpeg sources into the directory <var class="var">&lt;target&gt;</var> and let
  104. you push back your changes to the remote repository.
  105. </p>
  106. <div class="example">
  107. <pre class="example-preformatted">git clone git@ffmpeg.org:ffmpeg-web &lt;target&gt;
  108. </pre></div>
  109. <p>This will put the source of the FFmpeg website into the directory
  110. <var class="var">&lt;target&gt;</var> and let you push back your changes to the remote repository.
  111. </p>
  112. <p>If you don&rsquo;t have write-access to the ffmpeg-web repository, you can
  113. create patches after making a read-only ffmpeg-web clone:
  114. </p>
  115. <div class="example">
  116. <pre class="example-preformatted">git clone git://ffmpeg.org/ffmpeg-web &lt;target&gt;
  117. </pre></div>
  118. <p>Make sure that you do not have Windows line endings in your checkouts,
  119. otherwise you may experience spurious compilation failures. One way to
  120. achieve this is to run
  121. </p>
  122. <div class="example">
  123. <pre class="example-preformatted">git config --global core.autocrlf false
  124. </pre></div>
  125. <a class="anchor" id="Updating-the-source-tree-to-the-latest-revision"></a><a name="Updating-the-source-tree-to-the-latest-revision-1"></a>
  126. <h3 class="section">2.3 Updating the source tree to the latest revision<span class="pull-right"><a class="anchor hidden-xs" href="#Updating-the-source-tree-to-the-latest-revision-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Updating-the-source-tree-to-the-latest-revision-1" aria-hidden="true">TOC</a></span></h3>
  127. <div class="example">
  128. <pre class="example-preformatted">git pull (--rebase)
  129. </pre></div>
  130. <p>pulls in the latest changes from the tracked branch. The tracked branch
  131. can be remote. By default the master branch tracks the branch master in
  132. the remote origin.
  133. </p>
  134. <div class="warning">
  135. <p><code class="command">--rebase</code> (see below) is recommended.
  136. </p></div>
  137. <a name="Rebasing-your-local-branches"></a>
  138. <h3 class="section">2.4 Rebasing your local branches<span class="pull-right"><a class="anchor hidden-xs" href="#Rebasing-your-local-branches" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Rebasing-your-local-branches" aria-hidden="true">TOC</a></span></h3>
  139. <div class="example">
  140. <pre class="example-preformatted">git pull --rebase
  141. </pre></div>
  142. <p>fetches the changes from the main repository and replays your local commits
  143. over it. This is required to keep all your local changes at the top of
  144. FFmpeg&rsquo;s master tree. The master tree will reject pushes with merge commits.
  145. </p>
  146. <a name="Adding_002fremoving-files_002fdirectories"></a>
  147. <h3 class="section">2.5 Adding/removing files/directories<span class="pull-right"><a class="anchor hidden-xs" href="#Adding_002fremoving-files_002fdirectories" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Adding_002fremoving-files_002fdirectories" aria-hidden="true">TOC</a></span></h3>
  148. <div class="example">
  149. <pre class="example-preformatted">git add [-A] &lt;filename/dirname&gt;
  150. git rm [-r] &lt;filename/dirname&gt;
  151. </pre></div>
  152. <p>Git needs to get notified of all changes you make to your working
  153. directory that makes files appear or disappear.
  154. Line moves across files are automatically tracked.
  155. </p>
  156. <a name="Showing-modifications"></a>
  157. <h3 class="section">2.6 Showing modifications<span class="pull-right"><a class="anchor hidden-xs" href="#Showing-modifications" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Showing-modifications" aria-hidden="true">TOC</a></span></h3>
  158. <div class="example">
  159. <pre class="example-preformatted">git diff &lt;filename(s)&gt;
  160. </pre></div>
  161. <p>will show all local modifications in your working directory as unified diff.
  162. </p>
  163. <a name="Inspecting-the-changelog"></a>
  164. <h3 class="section">2.7 Inspecting the changelog<span class="pull-right"><a class="anchor hidden-xs" href="#Inspecting-the-changelog" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Inspecting-the-changelog" aria-hidden="true">TOC</a></span></h3>
  165. <div class="example">
  166. <pre class="example-preformatted">git log &lt;filename(s)&gt;
  167. </pre></div>
  168. <p>You may also use the graphical tools like <code class="command">gitview</code> or <code class="command">gitk</code>
  169. or the web interface available at <a class="url" href="https://git.ffmpeg.org/ffmpeg.git">https://git.ffmpeg.org/ffmpeg.git</a>.
  170. </p>
  171. <a name="Checking-source-tree-status"></a>
  172. <h3 class="section">2.8 Checking source tree status<span class="pull-right"><a class="anchor hidden-xs" href="#Checking-source-tree-status" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Checking-source-tree-status" aria-hidden="true">TOC</a></span></h3>
  173. <div class="example">
  174. <pre class="example-preformatted">git status
  175. </pre></div>
  176. <p>detects all the changes you made and lists what actions will be taken in case
  177. of a commit (additions, modifications, deletions, etc.).
  178. </p>
  179. <a name="Committing"></a>
  180. <h3 class="section">2.9 Committing<span class="pull-right"><a class="anchor hidden-xs" href="#Committing" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Committing" aria-hidden="true">TOC</a></span></h3>
  181. <div class="example">
  182. <pre class="example-preformatted">git diff --check
  183. </pre></div>
  184. <p>to double check your changes before committing them to avoid trouble later
  185. on. All experienced developers do this on each and every commit, no matter
  186. how small.
  187. </p>
  188. <p>Every one of them has been saved from looking like a fool by this many times.
  189. It&rsquo;s very easy for stray debug output or cosmetic modifications to slip in,
  190. please avoid problems through this extra level of scrutiny.
  191. </p>
  192. <p>For cosmetics-only commits you should get (almost) empty output from
  193. </p>
  194. <div class="example">
  195. <pre class="example-preformatted">git diff -w -b &lt;filename(s)&gt;
  196. </pre></div>
  197. <p>Also check the output of
  198. </p>
  199. <div class="example">
  200. <pre class="example-preformatted">git status
  201. </pre></div>
  202. <p>to make sure you don&rsquo;t have untracked files or deletions.
  203. </p>
  204. <div class="example">
  205. <pre class="example-preformatted">git add [-i|-p|-A] &lt;filenames/dirnames&gt;
  206. </pre></div>
  207. <p>Make sure you have told Git your name, email address and GPG key
  208. </p>
  209. <div class="example">
  210. <pre class="example-preformatted">git config --global user.name &quot;My Name&quot;
  211. git config --global user.email my@email.invalid
  212. git config --global user.signingkey ABCDEF0123245
  213. </pre></div>
  214. <p>Enable signing all commits or use -S
  215. </p>
  216. <div class="example">
  217. <pre class="example-preformatted">git config --global commit.gpgsign true
  218. </pre></div>
  219. <p>Use <samp class="option">--global</samp> to set the global configuration for all your Git checkouts.
  220. </p>
  221. <p>Git will select the changes to the files for commit. Optionally you can use
  222. the interactive or the patch mode to select hunk by hunk what should be
  223. added to the commit.
  224. </p>
  225. <div class="example">
  226. <pre class="example-preformatted">git commit
  227. </pre></div>
  228. <p>Git will commit the selected changes to your current local branch.
  229. </p>
  230. <p>You will be prompted for a log message in an editor, which is either
  231. set in your personal configuration file through
  232. </p>
  233. <div class="example">
  234. <pre class="example-preformatted">git config --global core.editor
  235. </pre></div>
  236. <p>or set by one of the following environment variables:
  237. <var class="var">GIT_EDITOR</var>, <var class="var">VISUAL</var> or <var class="var">EDITOR</var>.
  238. </p>
  239. <a name="Writing-a-commit-message"></a>
  240. <h3 class="section">2.10 Writing a commit message<span class="pull-right"><a class="anchor hidden-xs" href="#Writing-a-commit-message" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Writing-a-commit-message" aria-hidden="true">TOC</a></span></h3>
  241. <p>Log messages should be concise but descriptive.
  242. </p>
  243. <p>The first line must contain the context, a colon and a very short
  244. summary of what the commit does. Details can be added, if necessary,
  245. separated by an empty line. These details should not exceed 60-72 characters
  246. per line, except when containing code.
  247. </p>
  248. <p>Example of a good commit message:
  249. </p>
  250. <div class="example">
  251. <pre class="example-preformatted">avcodec/cbs: add a helper to read extradata within packet side data
  252. Using ff_cbs_read() on the raw buffer will not parse it as extradata,
  253. resulting in parsing errors for example when handling ISOBMFF avcC.
  254. This helper works around that.
  255. </pre></div>
  256. <div class="example">
  257. <pre class="example-preformatted">ptr might be NULL
  258. </pre></div>
  259. <p>If the summary on the first line is not enough, in the body of the message,
  260. explain why you made a change, what you did will be obvious from the changes
  261. themselves most of the time. Saying just &quot;bug fix&quot; or &quot;10l&quot; is bad. Remember
  262. that people of varying skill levels look at and educate themselves while
  263. reading through your code. Don&rsquo;t include filenames in log messages except in
  264. the context, Git provides that information.
  265. </p>
  266. <p>If the commit fixes a registered issue, state it in a separate line of the
  267. body: <code class="code">Fix Trac ticket #42.</code>
  268. </p>
  269. <p>The first line will be used to name
  270. the patch by <code class="command">git format-patch</code>.
  271. </p>
  272. <p>Common mistakes for the first line, as seen in <code class="command">git log --oneline</code>
  273. include: missing context at the beginning; description of what the code did
  274. before the patch; line too long or wrapped to the second line.
  275. </p>
  276. <a name="Preparing-a-patchset"></a>
  277. <h3 class="section">2.11 Preparing a patchset<span class="pull-right"><a class="anchor hidden-xs" href="#Preparing-a-patchset" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Preparing-a-patchset" aria-hidden="true">TOC</a></span></h3>
  278. <div class="example">
  279. <pre class="example-preformatted">git format-patch &lt;commit&gt; [-o directory]
  280. </pre></div>
  281. <p>will generate a set of patches for each commit between <var class="var">&lt;commit&gt;</var> and
  282. current <var class="var">HEAD</var>. E.g.
  283. </p>
  284. <div class="example">
  285. <pre class="example-preformatted">git format-patch origin/master
  286. </pre></div>
  287. <p>will generate patches for all commits on current branch which are not
  288. present in upstream.
  289. A useful shortcut is also
  290. </p>
  291. <div class="example">
  292. <pre class="example-preformatted">git format-patch -n
  293. </pre></div>
  294. <p>which will generate patches from last <var class="var">n</var> commits.
  295. By default the patches are created in the current directory.
  296. </p>
  297. <a name="Sending-patches-for-review"></a>
  298. <h3 class="section">2.12 Sending patches for review<span class="pull-right"><a class="anchor hidden-xs" href="#Sending-patches-for-review" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Sending-patches-for-review" aria-hidden="true">TOC</a></span></h3>
  299. <div class="example">
  300. <pre class="example-preformatted">git send-email &lt;commit list|directory&gt;
  301. </pre></div>
  302. <p>will send the patches created by <code class="command">git format-patch</code> or directly
  303. generates them. All the email fields can be configured in the global/local
  304. configuration or overridden by command line.
  305. Note that this tool must often be installed separately (e.g. <var class="var">git-email</var>
  306. package on Debian-based distros).
  307. </p>
  308. <a name="Renaming_002fmoving_002fcopying-files-or-contents-of-files"></a>
  309. <h3 class="section">2.13 Renaming/moving/copying files or contents of files<span class="pull-right"><a class="anchor hidden-xs" href="#Renaming_002fmoving_002fcopying-files-or-contents-of-files" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Renaming_002fmoving_002fcopying-files-or-contents-of-files" aria-hidden="true">TOC</a></span></h3>
  310. <p>Git automatically tracks such changes, making those normal commits.
  311. </p>
  312. <div class="example">
  313. <pre class="example-preformatted">mv/cp path/file otherpath/otherfile
  314. git add [-A] .
  315. git commit
  316. </pre></div>
  317. <a name="Git-configuration"></a>
  318. <h2 class="chapter">3 Git configuration<span class="pull-right"><a class="anchor hidden-xs" href="#Git-configuration" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Git-configuration" aria-hidden="true">TOC</a></span></h2>
  319. <p>In order to simplify a few workflows, it is advisable to configure both
  320. your personal Git installation and your local FFmpeg repository.
  321. </p>
  322. <a name="Personal-Git-installation"></a>
  323. <h3 class="section">3.1 Personal Git installation<span class="pull-right"><a class="anchor hidden-xs" href="#Personal-Git-installation" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Personal-Git-installation" aria-hidden="true">TOC</a></span></h3>
  324. <p>Add the following to your <samp class="file">~/.gitconfig</samp> to help <code class="command">git send-email</code>
  325. and <code class="command">git format-patch</code> detect renames:
  326. </p>
  327. <div class="example">
  328. <pre class="example-preformatted">[diff]
  329. renames = copy
  330. </pre></div>
  331. <a name="Repository-configuration"></a>
  332. <h3 class="section">3.2 Repository configuration<span class="pull-right"><a class="anchor hidden-xs" href="#Repository-configuration" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Repository-configuration" aria-hidden="true">TOC</a></span></h3>
  333. <p>In order to have <code class="command">git send-email</code> automatically send patches
  334. to the ffmpeg-devel mailing list, add the following stanza
  335. to <samp class="file">/path/to/ffmpeg/repository/.git/config</samp>:
  336. </p>
  337. <div class="example">
  338. <pre class="example-preformatted">[sendemail]
  339. to = ffmpeg-devel@ffmpeg.org
  340. </pre></div>
  341. <a name="FFmpeg-specific"></a>
  342. <h2 class="chapter">4 FFmpeg specific<span class="pull-right"><a class="anchor hidden-xs" href="#FFmpeg-specific" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-FFmpeg-specific" aria-hidden="true">TOC</a></span></h2>
  343. <a name="Reverting-broken-commits"></a>
  344. <h3 class="section">4.1 Reverting broken commits<span class="pull-right"><a class="anchor hidden-xs" href="#Reverting-broken-commits" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Reverting-broken-commits" aria-hidden="true">TOC</a></span></h3>
  345. <div class="example">
  346. <pre class="example-preformatted">git reset &lt;commit&gt;
  347. </pre></div>
  348. <p><code class="command">git reset</code> will uncommit the changes till <var class="var">&lt;commit&gt;</var> rewriting
  349. the current branch history.
  350. </p>
  351. <div class="example">
  352. <pre class="example-preformatted">git commit --amend
  353. </pre></div>
  354. <p>allows one to amend the last commit details quickly.
  355. </p>
  356. <div class="example">
  357. <pre class="example-preformatted">git rebase -i origin/master
  358. </pre></div>
  359. <p>will replay local commits over the main repository allowing to edit, merge
  360. or remove some of them in the process.
  361. </p>
  362. <div class="info">
  363. <p><code class="command">git reset</code>, <code class="command">git commit --amend</code> and <code class="command">git rebase</code>
  364. rewrite history, so you should use them ONLY on your local or topic branches.
  365. The main repository will reject those changes.
  366. </p></div>
  367. <div class="example">
  368. <pre class="example-preformatted">git revert &lt;commit&gt;
  369. </pre></div>
  370. <p><code class="command">git revert</code> will generate a revert commit. This will not make the
  371. faulty commit disappear from the history.
  372. </p>
  373. <a name="Pushing-changes-to-remote-trees"></a>
  374. <h3 class="section">4.2 Pushing changes to remote trees<span class="pull-right"><a class="anchor hidden-xs" href="#Pushing-changes-to-remote-trees" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Pushing-changes-to-remote-trees" aria-hidden="true">TOC</a></span></h3>
  375. <div class="example">
  376. <pre class="example-preformatted">git push origin master --dry-run
  377. </pre></div>
  378. <p>Will simulate a push of the local master branch to the default remote
  379. (<var class="var">origin</var>). And list which branches and ranges or commits would have been
  380. pushed.
  381. Git will prevent you from pushing changes if the local and remote trees are
  382. out of sync. Refer to <a class="ref" href="#Updating-the-source-tree-to-the-latest-revision">Updating the source tree to the latest revision</a>.
  383. </p>
  384. <div class="example">
  385. <pre class="example-preformatted">git remote add &lt;name&gt; &lt;url&gt;
  386. </pre></div>
  387. <p>Will add additional remote with a name reference, it is useful if you want
  388. to push your local branch for review on a remote host.
  389. </p>
  390. <div class="example">
  391. <pre class="example-preformatted">git push &lt;remote&gt; &lt;refspec&gt;
  392. </pre></div>
  393. <p>Will push the changes to the <var class="var">&lt;remote&gt;</var> repository.
  394. Omitting <var class="var">&lt;refspec&gt;</var> makes <code class="command">git push</code> update all the remote
  395. branches matching the local ones.
  396. </p>
  397. <a name="Finding-a-specific-svn-revision"></a>
  398. <h3 class="section">4.3 Finding a specific svn revision<span class="pull-right"><a class="anchor hidden-xs" href="#Finding-a-specific-svn-revision" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Finding-a-specific-svn-revision" aria-hidden="true">TOC</a></span></h3>
  399. <p>Since version 1.7.1 Git supports &lsquo;<samp class="samp">:/foo</samp>&rsquo; syntax for specifying commits
  400. based on a regular expression. see man gitrevisions
  401. </p>
  402. <div class="example">
  403. <pre class="example-preformatted">git show :/'as revision 23456'
  404. </pre></div>
  405. <p>will show the svn changeset &lsquo;<samp class="samp">r23456</samp>&rsquo;. With older Git versions searching in
  406. the <code class="command">git log</code> output is the easiest option (especially if a pager with
  407. search capabilities is used).
  408. </p>
  409. <p>This commit can be checked out with
  410. </p>
  411. <div class="example">
  412. <pre class="example-preformatted">git checkout -b svn_23456 :/'as revision 23456'
  413. </pre></div>
  414. <p>or for Git &lt; 1.7.1 with
  415. </p>
  416. <div class="example">
  417. <pre class="example-preformatted">git checkout -b svn_23456 $SHA1
  418. </pre></div>
  419. <p>where <var class="var">$SHA1</var> is the commit hash from the <code class="command">git log</code> output.
  420. </p>
  421. <a name="gpg-key-generation"></a>
  422. <h2 class="chapter">5 gpg key generation<span class="pull-right"><a class="anchor hidden-xs" href="#gpg-key-generation" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-gpg-key-generation" aria-hidden="true">TOC</a></span></h2>
  423. <p>If you have no gpg key yet, we recommend that you create a ed25519 based key as it
  424. is small, fast and secure. Especially it results in small signatures in git.
  425. </p>
  426. <div class="example">
  427. <pre class="example-preformatted">gpg --default-new-key-algo &quot;ed25519/cert,sign+cv25519/encr&quot; --quick-generate-key &quot;human@server.com&quot;
  428. </pre></div>
  429. <p>When generating a key, make sure the email specified matches the email used in git as some sites like
  430. github consider mismatches a reason to declare such commits unverified. After generating a key you
  431. can add it to the MAINTAINER file and upload it to a keyserver.
  432. </p>
  433. <a name="Pre_002dpush-checklist"></a>
  434. <h2 class="chapter">6 Pre-push checklist<span class="pull-right"><a class="anchor hidden-xs" href="#Pre_002dpush-checklist" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Pre_002dpush-checklist" aria-hidden="true">TOC</a></span></h2>
  435. <p>Once you have a set of commits that you feel are ready for pushing,
  436. work through the following checklist to doublecheck everything is in
  437. proper order. This list tries to be exhaustive. In case you are just
  438. pushing a typo in a comment, some of the steps may be unnecessary.
  439. Apply your common sense, but if in doubt, err on the side of caution.
  440. </p>
  441. <p>First, make sure that the commits and branches you are going to push
  442. match what you want pushed and that nothing is missing, extraneous or
  443. wrong. You can see what will be pushed by running the git push command
  444. with <samp class="option">--dry-run</samp> first. And then inspecting the commits listed with
  445. <code class="command">git log -p 1234567..987654</code>. The <code class="command">git status</code> command
  446. may help in finding local changes that have been forgotten to be added.
  447. </p>
  448. <p>Next let the code pass through a full run of our test suite.
  449. </p>
  450. <ul class="itemize mark-bullet">
  451. <li><code class="command">make distclean</code>
  452. </li><li><code class="command">/path/to/ffmpeg/configure</code>
  453. </li><li><code class="command">make fate</code>
  454. </li><li>if fate fails due to missing samples run <code class="command">make fate-rsync</code> and retry
  455. </li></ul>
  456. <p>Make sure all your changes have been checked before pushing them, the
  457. test suite only checks against regressions and that only to some extend. It does
  458. obviously not check newly added features/code to be working unless you have
  459. added a test for that (which is recommended).
  460. </p>
  461. <p>Also note that every single commit should pass the test suite, not just
  462. the result of a series of patches.
  463. </p>
  464. <p>Once everything passed, push the changes to your public ffmpeg clone and post a
  465. merge request to ffmpeg-devel. You can also push them directly but this is not
  466. recommended.
  467. </p>
  468. <a name="Server-Issues"></a>
  469. <h2 class="chapter">7 Server Issues<span class="pull-right"><a class="anchor hidden-xs" href="#Server-Issues" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Server-Issues" aria-hidden="true">TOC</a></span></h2>
  470. <p>Contact the project admins at <a class="email" href="mailto:root@ffmpeg.org">root@ffmpeg.org</a> if you have technical
  471. problems with the Git server.
  472. </p> <p style="font-size: small;">
  473. This document was generated using <a class="uref" href="https://www.gnu.org/software/texinfo/"><em class="emph">makeinfo</em></a>.
  474. </p>
  475. </div>
  476. </body>
  477. </html>