123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8" />
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
- <title>FFmpeg documentation</title>
- <link rel="stylesheet" href="bootstrap.min.css" />
- <link rel="stylesheet" href="style.min.css" />
-
- <meta name="description" content="Using Git to develop FFmpeg: ">
- <meta name="keywords" content="FFmpeg documentation : Using Git to develop FFmpeg: ">
- <meta name="Generator" content="texi2html 5.0">
- <!-- Created on March 9, 2020 by texi2html 5.0 -->
- <!--
- texi2html was written by:
- Lionel Cons <Lionel.Cons@cern.ch> (original author)
- Karl Berry <karl@freefriends.org>
- Olaf Bachmann <obachman@mathematik.uni-kl.de>
- and many others.
- Maintained by: Many creative people.
- Send bugs and suggestions to <texi2html-bug@nongnu.org>
-
- -->
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- </head>
- <body>
- <div class="container">
-
- <h1 class="titlefont">Using Git to develop FFmpeg</h1>
- <hr>
- <a name="SEC_Top"></a>
-
- <a name="SEC_Contents"></a>
- <h1>Table of Contents</h1>
-
- <div class="contents">
-
- <ul class="no-bullet">
- <li><a name="toc-Introduction" href="#Introduction">1 Introduction</a></li>
- <li><a name="toc-Basics-Usage" href="#Basics-Usage">2 Basics Usage</a>
- <ul class="no-bullet">
- <li><a name="toc-Get-Git" href="#Get-Git">2.1 Get Git</a></li>
- <li><a name="toc-Cloning-the-source-tree" href="#Cloning-the-source-tree">2.2 Cloning the source tree</a></li>
- <li><a name="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>
- <li><a name="toc-Rebasing-your-local-branches" href="#Rebasing-your-local-branches">2.4 Rebasing your local branches</a></li>
- <li><a name="toc-Adding_002fremoving-files_002fdirectories" href="#Adding_002fremoving-files_002fdirectories">2.5 Adding/removing files/directories</a></li>
- <li><a name="toc-Showing-modifications" href="#Showing-modifications">2.6 Showing modifications</a></li>
- <li><a name="toc-Inspecting-the-changelog" href="#Inspecting-the-changelog">2.7 Inspecting the changelog</a></li>
- <li><a name="toc-Checking-source-tree-status" href="#Checking-source-tree-status">2.8 Checking source tree status</a></li>
- <li><a name="toc-Committing" href="#Committing">2.9 Committing</a></li>
- <li><a name="toc-Preparing-a-patchset" href="#Preparing-a-patchset">2.10 Preparing a patchset</a></li>
- <li><a name="toc-Sending-patches-for-review" href="#Sending-patches-for-review">2.11 Sending patches for review</a></li>
- <li><a name="toc-Renaming_002fmoving_002fcopying-files-or-contents-of-files" href="#Renaming_002fmoving_002fcopying-files-or-contents-of-files">2.12 Renaming/moving/copying files or contents of files</a></li>
- </ul></li>
- <li><a name="toc-Git-configuration" href="#Git-configuration">3 Git configuration</a>
- <ul class="no-bullet">
- <li><a name="toc-Personal-Git-installation" href="#Personal-Git-installation">3.1 Personal Git installation</a></li>
- <li><a name="toc-Repository-configuration" href="#Repository-configuration">3.2 Repository configuration</a></li>
- </ul></li>
- <li><a name="toc-FFmpeg-specific" href="#FFmpeg-specific">4 FFmpeg specific</a>
- <ul class="no-bullet">
- <li><a name="toc-Reverting-broken-commits" href="#Reverting-broken-commits">4.1 Reverting broken commits</a></li>
- <li><a name="toc-Pushing-changes-to-remote-trees" href="#Pushing-changes-to-remote-trees">4.2 Pushing changes to remote trees</a></li>
- <li><a name="toc-Finding-a-specific-svn-revision" href="#Finding-a-specific-svn-revision">4.3 Finding a specific svn revision</a></li>
- </ul></li>
- <li><a name="toc-Pre_002dpush-checklist" href="#Pre_002dpush-checklist">5 Pre-push checklist</a></li>
- <li><a name="toc-Server-Issues" href="#Server-Issues">6 Server Issues</a></li>
- </ul>
- </div>
-
-
- <hr size="6">
- <a name="Introduction"></a>
- <h1 class="chapter"><a href="git-howto.html#toc-Introduction">1 Introduction</a></h1>
-
- <p>This document aims in giving some quick references on a set of useful Git
- commands. You should always use the extensive and detailed documentation
- provided directly by Git:
- </p>
- <div class="example">
- <pre class="example">git --help
- man git
- </pre></div>
-
- <p>shows you the available subcommands,
- </p>
- <div class="example">
- <pre class="example">git <command> --help
- man git-<command>
- </pre></div>
-
- <p>shows information about the subcommand <command>.
- </p>
- <p>Additional information could be found on the
- <a href="http://gitref.org">Git Reference</a> website.
- </p>
- <p>For more information about the Git project, visit the
- <a href="http://git-scm.com/">Git website</a>.
- </p>
- <p>Consult these resources whenever you have problems, they are quite exhaustive.
- </p>
- <p>What follows now is a basic introduction to Git and some FFmpeg-specific
- guidelines to ease the contribution to the project.
- </p>
- <a name="Basics-Usage"></a>
- <h1 class="chapter"><a href="git-howto.html#toc-Basics-Usage">2 Basics Usage</a></h1>
-
- <a name="Get-Git"></a>
- <h2 class="section"><a href="git-howto.html#toc-Get-Git">2.1 Get Git</a></h2>
-
- <p>You can get Git from <a href="http://git-scm.com/">http://git-scm.com/</a>
- Most distribution and operating system provide a package for it.
- </p>
-
- <a name="Cloning-the-source-tree"></a>
- <h2 class="section"><a href="git-howto.html#toc-Cloning-the-source-tree">2.2 Cloning the source tree</a></h2>
-
- <div class="example">
- <pre class="example">git clone git://source.ffmpeg.org/ffmpeg <target>
- </pre></div>
-
- <p>This will put the FFmpeg sources into the directory <var><target></var>.
- </p>
- <div class="example">
- <pre class="example">git clone git@source.ffmpeg.org:ffmpeg <target>
- </pre></div>
-
- <p>This will put the FFmpeg sources into the directory <var><target></var> and let
- you push back your changes to the remote repository.
- </p>
- <div class="example">
- <pre class="example">git clone gil@ffmpeg.org:ffmpeg-web <target>
- </pre></div>
-
- <p>This will put the source of the FFmpeg website into the directory
- <var><target></var> and let you push back your changes to the remote repository.
- (Note that <var>gil</var> stands for GItoLite and is not a typo of <var>git</var>.)
- </p>
- <p>If you don’t have write-access to the ffmpeg-web repository, you can
- create patches after making a read-only ffmpeg-web clone:
- </p>
- <div class="example">
- <pre class="example">git clone git://ffmpeg.org/ffmpeg-web <target>
- </pre></div>
-
- <p>Make sure that you do not have Windows line endings in your checkouts,
- otherwise you may experience spurious compilation failures. One way to
- achieve this is to run
- </p>
- <div class="example">
- <pre class="example">git config --global core.autocrlf false
- </pre></div>
-
-
- <p><a name="Updating-the-source-tree-to-the-latest-revision"></a>
- </p><a name="Updating-the-source-tree-to-the-latest-revision-1"></a>
- <h2 class="section"><a href="git-howto.html#toc-Updating-the-source-tree-to-the-latest-revision-1">2.3 Updating the source tree to the latest revision</a></h2>
-
- <div class="example">
- <pre class="example">git pull (--rebase)
- </pre></div>
-
- <p>pulls in the latest changes from the tracked branch. The tracked branch
- can be remote. By default the master branch tracks the branch master in
- the remote origin.
- </p>
- <div class="float alert alert-warning">
- <p><code>--rebase</code> (see below) is recommended.
- </p></div>
- <a name="Rebasing-your-local-branches"></a>
- <h2 class="section"><a href="git-howto.html#toc-Rebasing-your-local-branches">2.4 Rebasing your local branches</a></h2>
-
- <div class="example">
- <pre class="example">git pull --rebase
- </pre></div>
-
- <p>fetches the changes from the main repository and replays your local commits
- over it. This is required to keep all your local changes at the top of
- FFmpeg’s master tree. The master tree will reject pushes with merge commits.
- </p>
-
- <a name="Adding_002fremoving-files_002fdirectories"></a>
- <h2 class="section"><a href="git-howto.html#toc-Adding_002fremoving-files_002fdirectories">2.5 Adding/removing files/directories</a></h2>
-
- <div class="example">
- <pre class="example">git add [-A] <filename/dirname>
- git rm [-r] <filename/dirname>
- </pre></div>
-
- <p>Git needs to get notified of all changes you make to your working
- directory that makes files appear or disappear.
- Line moves across files are automatically tracked.
- </p>
-
- <a name="Showing-modifications"></a>
- <h2 class="section"><a href="git-howto.html#toc-Showing-modifications">2.6 Showing modifications</a></h2>
-
- <div class="example">
- <pre class="example">git diff <filename(s)>
- </pre></div>
-
- <p>will show all local modifications in your working directory as unified diff.
- </p>
-
- <a name="Inspecting-the-changelog"></a>
- <h2 class="section"><a href="git-howto.html#toc-Inspecting-the-changelog">2.7 Inspecting the changelog</a></h2>
-
- <div class="example">
- <pre class="example">git log <filename(s)>
- </pre></div>
-
- <p>You may also use the graphical tools like <code>gitview</code> or <code>gitk</code>
- or the web interface available at <a href="http://source.ffmpeg.org/">http://source.ffmpeg.org/</a>.
- </p>
- <a name="Checking-source-tree-status"></a>
- <h2 class="section"><a href="git-howto.html#toc-Checking-source-tree-status">2.8 Checking source tree status</a></h2>
-
- <div class="example">
- <pre class="example">git status
- </pre></div>
-
- <p>detects all the changes you made and lists what actions will be taken in case
- of a commit (additions, modifications, deletions, etc.).
- </p>
-
- <a name="Committing"></a>
- <h2 class="section"><a href="git-howto.html#toc-Committing">2.9 Committing</a></h2>
-
- <div class="example">
- <pre class="example">git diff --check
- </pre></div>
-
- <p>to double check your changes before committing them to avoid trouble later
- on. All experienced developers do this on each and every commit, no matter
- how small.
- </p>
- <p>Every one of them has been saved from looking like a fool by this many times.
- It’s very easy for stray debug output or cosmetic modifications to slip in,
- please avoid problems through this extra level of scrutiny.
- </p>
- <p>For cosmetics-only commits you should get (almost) empty output from
- </p>
- <div class="example">
- <pre class="example">git diff -w -b <filename(s)>
- </pre></div>
-
- <p>Also check the output of
- </p>
- <div class="example">
- <pre class="example">git status
- </pre></div>
-
- <p>to make sure you don’t have untracked files or deletions.
- </p>
- <div class="example">
- <pre class="example">git add [-i|-p|-A] <filenames/dirnames>
- </pre></div>
-
- <p>Make sure you have told Git your name and email address
- </p>
- <div class="example">
- <pre class="example">git config --global user.name "My Name"
- git config --global user.email my@email.invalid
- </pre></div>
-
- <p>Use ‘<samp>--global</samp>’ to set the global configuration for all your Git checkouts.
- </p>
- <p>Git will select the changes to the files for commit. Optionally you can use
- the interactive or the patch mode to select hunk by hunk what should be
- added to the commit.
- </p>
-
- <div class="example">
- <pre class="example">git commit
- </pre></div>
-
- <p>Git will commit the selected changes to your current local branch.
- </p>
- <p>You will be prompted for a log message in an editor, which is either
- set in your personal configuration file through
- </p>
- <div class="example">
- <pre class="example">git config --global core.editor
- </pre></div>
-
- <p>or set by one of the following environment variables:
- <var>GIT_EDITOR</var>, <var>VISUAL</var> or <var>EDITOR</var>.
- </p>
- <p>Log messages should be concise but descriptive. Explain why you made a change,
- what you did will be obvious from the changes themselves most of the time.
- Saying just "bug fix" or "10l" is bad. Remember that people of varying skill
- levels look at and educate themselves while reading through your code. Don’t
- include filenames in log messages, Git provides that information.
- </p>
- <p>Possibly make the commit message have a terse, descriptive first line, an
- empty line and then a full description. The first line will be used to name
- the patch by <code>git format-patch</code>.
- </p>
- <a name="Preparing-a-patchset"></a>
- <h2 class="section"><a href="git-howto.html#toc-Preparing-a-patchset">2.10 Preparing a patchset</a></h2>
-
- <div class="example">
- <pre class="example">git format-patch <commit> [-o directory]
- </pre></div>
-
- <p>will generate a set of patches for each commit between <var><commit></var> and
- current <var>HEAD</var>. E.g.
- </p>
- <div class="example">
- <pre class="example">git format-patch origin/master
- </pre></div>
-
- <p>will generate patches for all commits on current branch which are not
- present in upstream.
- A useful shortcut is also
- </p>
- <div class="example">
- <pre class="example">git format-patch -n
- </pre></div>
-
- <p>which will generate patches from last <var>n</var> commits.
- By default the patches are created in the current directory.
- </p>
- <a name="Sending-patches-for-review"></a>
- <h2 class="section"><a href="git-howto.html#toc-Sending-patches-for-review">2.11 Sending patches for review</a></h2>
-
- <div class="example">
- <pre class="example">git send-email <commit list|directory>
- </pre></div>
-
- <p>will send the patches created by <code>git format-patch</code> or directly
- generates them. All the email fields can be configured in the global/local
- configuration or overridden by command line.
- Note that this tool must often be installed separately (e.g. <var>git-email</var>
- package on Debian-based distros).
- </p>
-
- <a name="Renaming_002fmoving_002fcopying-files-or-contents-of-files"></a>
- <h2 class="section"><a href="git-howto.html#toc-Renaming_002fmoving_002fcopying-files-or-contents-of-files">2.12 Renaming/moving/copying files or contents of files</a></h2>
-
- <p>Git automatically tracks such changes, making those normal commits.
- </p>
- <div class="example">
- <pre class="example">mv/cp path/file otherpath/otherfile
- git add [-A] .
- git commit
- </pre></div>
-
-
- <a name="Git-configuration"></a>
- <h1 class="chapter"><a href="git-howto.html#toc-Git-configuration">3 Git configuration</a></h1>
-
- <p>In order to simplify a few workflows, it is advisable to configure both
- your personal Git installation and your local FFmpeg repository.
- </p>
- <a name="Personal-Git-installation"></a>
- <h2 class="section"><a href="git-howto.html#toc-Personal-Git-installation">3.1 Personal Git installation</a></h2>
-
- <p>Add the following to your ‘<tt>~/.gitconfig</tt>’ to help <code>git send-email</code>
- and <code>git format-patch</code> detect renames:
- </p>
- <div class="example">
- <pre class="example">[diff]
- renames = copy
- </pre></div>
-
- <a name="Repository-configuration"></a>
- <h2 class="section"><a href="git-howto.html#toc-Repository-configuration">3.2 Repository configuration</a></h2>
-
- <p>In order to have <code>git send-email</code> automatically send patches
- to the ffmpeg-devel mailing list, add the following stanza
- to ‘<tt>/path/to/ffmpeg/repository/.git/config</tt>’:
- </p>
- <div class="example">
- <pre class="example">[sendemail]
- to = ffmpeg-devel@ffmpeg.org
- </pre></div>
-
- <a name="FFmpeg-specific"></a>
- <h1 class="chapter"><a href="git-howto.html#toc-FFmpeg-specific">4 FFmpeg specific</a></h1>
-
- <a name="Reverting-broken-commits"></a>
- <h2 class="section"><a href="git-howto.html#toc-Reverting-broken-commits">4.1 Reverting broken commits</a></h2>
-
- <div class="example">
- <pre class="example">git reset <commit>
- </pre></div>
-
- <p><code>git reset</code> will uncommit the changes till <var><commit></var> rewriting
- the current branch history.
- </p>
- <div class="example">
- <pre class="example">git commit --amend
- </pre></div>
-
- <p>allows one to amend the last commit details quickly.
- </p>
- <div class="example">
- <pre class="example">git rebase -i origin/master
- </pre></div>
-
- <p>will replay local commits over the main repository allowing to edit, merge
- or remove some of them in the process.
- </p>
- <div class="float alert alert-info">
- <p><code>git reset</code>, <code>git commit --amend</code> and <code>git rebase</code>
- rewrite history, so you should use them ONLY on your local or topic branches.
- The main repository will reject those changes.
- </p></div>
- <div class="example">
- <pre class="example">git revert <commit>
- </pre></div>
-
- <p><code>git revert</code> will generate a revert commit. This will not make the
- faulty commit disappear from the history.
- </p>
- <a name="Pushing-changes-to-remote-trees"></a>
- <h2 class="section"><a href="git-howto.html#toc-Pushing-changes-to-remote-trees">4.2 Pushing changes to remote trees</a></h2>
-
- <div class="example">
- <pre class="example">git push origin master --dry-run
- </pre></div>
-
- <p>Will simulate a push of the local master branch to the default remote
- (<var>origin</var>). And list which branches and ranges or commits would have been
- pushed.
- Git will prevent you from pushing changes if the local and remote trees are
- out of sync. Refer to <a href="#Updating-the-source-tree-to-the-latest-revision">Updating the source tree to the latest revision</a>.
- </p>
- <div class="example">
- <pre class="example">git remote add <name> <url>
- </pre></div>
-
- <p>Will add additional remote with a name reference, it is useful if you want
- to push your local branch for review on a remote host.
- </p>
- <div class="example">
- <pre class="example">git push <remote> <refspec>
- </pre></div>
-
- <p>Will push the changes to the <var><remote></var> repository.
- Omitting <var><refspec></var> makes <code>git push</code> update all the remote
- branches matching the local ones.
- </p>
- <a name="Finding-a-specific-svn-revision"></a>
- <h2 class="section"><a href="git-howto.html#toc-Finding-a-specific-svn-revision">4.3 Finding a specific svn revision</a></h2>
-
- <p>Since version 1.7.1 Git supports ‘<samp>:/foo</samp>’ syntax for specifying commits
- based on a regular expression. see man gitrevisions
- </p>
- <div class="example">
- <pre class="example">git show :/'as revision 23456'
- </pre></div>
-
- <p>will show the svn changeset ‘<samp>r23456</samp>’. With older Git versions searching in
- the <code>git log</code> output is the easiest option (especially if a pager with
- search capabilities is used).
- </p>
- <p>This commit can be checked out with
- </p>
- <div class="example">
- <pre class="example">git checkout -b svn_23456 :/'as revision 23456'
- </pre></div>
-
- <p>or for Git < 1.7.1 with
- </p>
- <div class="example">
- <pre class="example">git checkout -b svn_23456 $SHA1
- </pre></div>
-
- <p>where <var>$SHA1</var> is the commit hash from the <code>git log</code> output.
- </p>
-
- <a name="Pre_002dpush-checklist"></a>
- <h1 class="chapter"><a href="git-howto.html#toc-Pre_002dpush-checklist">5 Pre-push checklist</a></h1>
-
- <p>Once you have a set of commits that you feel are ready for pushing,
- work through the following checklist to doublecheck everything is in
- proper order. This list tries to be exhaustive. In case you are just
- pushing a typo in a comment, some of the steps may be unnecessary.
- Apply your common sense, but if in doubt, err on the side of caution.
- </p>
- <p>First, make sure that the commits and branches you are going to push
- match what you want pushed and that nothing is missing, extraneous or
- wrong. You can see what will be pushed by running the git push command
- with ‘<samp>--dry-run</samp>’ first. And then inspecting the commits listed with
- <code>git log -p 1234567..987654</code>. The <code>git status</code> command
- may help in finding local changes that have been forgotten to be added.
- </p>
- <p>Next let the code pass through a full run of our test suite.
- </p>
- <ul>
- <li> <code>make distclean</code>
- </li><li> <code>/path/to/ffmpeg/configure</code>
- </li><li> <code>make fate</code>
- </li><li> if fate fails due to missing samples run <code>make fate-rsync</code> and retry
- </li></ul>
-
- <p>Make sure all your changes have been checked before pushing them, the
- test suite only checks against regressions and that only to some extend. It does
- obviously not check newly added features/code to be working unless you have
- added a test for that (which is recommended).
- </p>
- <p>Also note that every single commit should pass the test suite, not just
- the result of a series of patches.
- </p>
- <p>Once everything passed, push the changes to your public ffmpeg clone and post a
- merge request to ffmpeg-devel. You can also push them directly but this is not
- recommended.
- </p>
- <a name="Server-Issues"></a>
- <h1 class="chapter"><a href="git-howto.html#toc-Server-Issues">6 Server Issues</a></h1>
-
- <p>Contact the project admins at <a href="mailto:root@ffmpeg.org">root@ffmpeg.org</a> if you have technical
- problems with the Git server.
- </p> </div>
- </body>
- </html>
|