git-howto.html 27 KB

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