Files
itgmania212121/extern/ffmpeg/doc/git-howto.html
T
2012-03-10 18:45:31 -06:00

450 lines
17 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on January 27, 2012 by texi2html 1.82 -->
<!--
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>
-->
<head>
<title>FFmpeg documentation : : </title>
<meta name="description" content=": ">
<meta name="keywords" content="FFmpeg documentation : : ">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.82">
<style type="text/css">
<!--
a.summary-letter { text-decoration: none }
a { color: #2D6198; }
a:visited { color: #884488; }
h1 a, h2 a, h3 a { text-decoration: inherit; color: inherit; }
p { margin-left: 1em; margin-right: 1em; }
table { margin-left: 2em; }
pre { margin-left: 2em; }
#footer { text-align: center; }
#body { margin-left: 1em; margin-right: 1em; }
body { background-color: #313131; margin: 0; }
#container {
background-color: white;
color: #202020;
margin-left: 1em;
margin-right: 1em;
}
h1 {
background-color: #7BB37B;
border: 1px solid #6A996A;
color: #151515;
font-size: 1.2em;
padding-bottom: 0.2em;
padding-left: 0.4em;
padding-top: 0.2em;
}
h2 {
color: #313131;
font-size: 1.2em;
}
h3 {
color: #313131;
font-size: 0.8em;
margin-bottom: -8px;
}
.note {
margin: 1em;
border: 1px solid #bbc9d8;
background-color: #dde1e1;
}
.important {
margin: 1em;
border: 1px solid #d26767;
background-color: #f8e1e1;
}
-->
</style>
<link rel="icon" href="favicon.png" type="image/png" />
<link rel="stylesheet" type="text/css" href="default.css" />
</head>
<body >
<div id="container">
<div id="body">
<a name="SEC_Top"></a>
<h1 class="settitle">Using git to develop FFmpeg</h1>
<a name="SEC_Contents"></a>
<h1>Table of Contents</h1>
<div class="contents">
<ul class="toc">
<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="toc">
<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" href="#Updating-the-source-tree-to-the-latest-revision">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-FFmpeg-specific" href="#FFmpeg-specific">3. FFmpeg specific</a>
<ul class="toc">
<li><a name="toc-Reverting-broken-commits" href="#Reverting-broken-commits">3.1 Reverting broken commits</a></li>
<li><a name="toc-Pushing-changes-to-remote-trees" href="#Pushing-changes-to-remote-trees">3.2 Pushing changes to remote trees</a></li>
<li><a name="toc-Finding-a-specific-svn-revision" href="#Finding-a-specific-svn-revision">3.3 Finding a specific svn revision</a></li>
</ul></li>
<li><a name="toc-Server-Issues" href="#Server-Issues">4. Server Issues</a></li>
</ul>
</div>
<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>
<table><tr><td>&nbsp;</td><td><pre class="example">git --help
man git
</pre></td></tr></table>
<p>shows you the available subcommands,
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">git &lt;command&gt; --help
man git-&lt;command&gt;
</pre></td></tr></table>
<p>shows information about the subcommand &lt;command&gt;.
</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
</p>
<p><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>
<table><tr><td>&nbsp;</td><td><pre class="example">git clone git://source.ffmpeg.org/ffmpeg &lt;target&gt;
</pre></td></tr></table>
<p>This will put the FFmpeg sources into the directory <var>&lt;target&gt;</var>.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">git clone git@source.ffmpeg.org:ffmpeg &lt;target&gt;
</pre></td></tr></table>
<p>This will put the FFmpeg sources into the directory <var>&lt;target&gt;</var> and let
you push back your changes to the remote repository.
</p>
<a name="Updating-the-source-tree-to-the-latest-revision"></a>
<h2 class="section"><a href="git-howto.html#toc-Updating-the-source-tree-to-the-latest-revision">2.3 Updating the source tree to the latest revision</a></h2>
<table><tr><td>&nbsp;</td><td><pre class="example">git pull (--rebase)
</pre></td></tr></table>
<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 important">
<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>
<table><tr><td>&nbsp;</td><td><pre class="example">git pull --rebase
</pre></td></tr></table>
<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&rsquo;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>
<table><tr><td>&nbsp;</td><td><pre class="example">git add [-A] &lt;filename/dirname&gt;
git rm [-r] &lt;filename/dirname&gt;
</pre></td></tr></table>
<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>
<table><tr><td>&nbsp;</td><td><pre class="example">git diff &lt;filename(s)&gt;
</pre></td></tr></table>
<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>
<table><tr><td>&nbsp;</td><td><pre class="example">git log &lt;filename(s)&gt;
</pre></td></tr></table>
<p>You may also use the graphical tools like gitview or gitk or the web
interface available at http://source.ffmpeg.org/
</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>
<table><tr><td>&nbsp;</td><td><pre class="example">git status
</pre></td></tr></table>
<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>
<table><tr><td>&nbsp;</td><td><pre class="example">git diff --check
</pre></td></tr></table>
<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.
Every one of them has been saved from looking like a fool by this many times.
It&rsquo;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>
<table><tr><td>&nbsp;</td><td><pre class="example">git diff -w -b &lt;filename(s)&gt;
</pre></td></tr></table>
<p>Also check the output of
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">git status
</pre></td></tr></table>
<p>to make sure you don&rsquo;t have untracked files or deletions.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">git add [-i|-p|-A] &lt;filenames/dirnames&gt;
</pre></td></tr></table>
<p>Make sure you have told git your name and email address
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">git config --global user.name &quot;My Name&quot;
git config --global user.email my@email.invalid
</pre></td></tr></table>
<p>Use <var>&ndash;global</var> 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>
<table><tr><td>&nbsp;</td><td><pre class="example">git commit
</pre></td></tr></table>
<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>
<table><tr><td>&nbsp;</td><td><pre class="example">git config --global core.editor
</pre></td></tr></table>
<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 &quot;bug fix&quot; or &quot;10l&quot; is bad. Remember that people of varying skill
levels look at and educate themselves while reading through your code. Don&rsquo;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 git format-patch.
</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>
<table><tr><td>&nbsp;</td><td><pre class="example">git format-patch &lt;commit&gt; [-o directory]
</pre></td></tr></table>
<p>will generate a set of patches for each commit between <var>&lt;commit&gt;</var> and
current <var>HEAD</var>. E.g.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">git format-patch origin/master
</pre></td></tr></table>
<p>will generate patches for all commits on current branch which are not
present in upstream.
A useful shortcut is also
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">git format-patch -n
</pre></td></tr></table>
<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>
<table><tr><td>&nbsp;</td><td><pre class="example">git send-email &lt;commit list|directory&gt;
</pre></td></tr></table>
<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>
<table><tr><td>&nbsp;</td><td><pre class="example">mv/cp path/file otherpath/otherfile
git add [-A] .
git commit
</pre></td></tr></table>
<a name="FFmpeg-specific"></a>
<h1 class="chapter"><a href="git-howto.html#toc-FFmpeg-specific">3. FFmpeg specific</a></h1>
<a name="Reverting-broken-commits"></a>
<h2 class="section"><a href="git-howto.html#toc-Reverting-broken-commits">3.1 Reverting broken commits</a></h2>
<table><tr><td>&nbsp;</td><td><pre class="example">git reset &lt;commit&gt;
</pre></td></tr></table>
<p><code>git reset</code> will uncommit the changes till <var>&lt;commit&gt;</var> rewriting
the current branch history.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">git commit --amend
</pre></td></tr></table>
<p>allows to amend the last commit details quickly.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">git rebase -i origin/master
</pre></td></tr></table>
<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 note">
<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>
<table><tr><td>&nbsp;</td><td><pre class="example">git revert &lt;commit&gt;
</pre></td></tr></table>
<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">3.2 Pushing changes to remote trees</a></h2>
<table><tr><td>&nbsp;</td><td><pre class="example">git push
</pre></td></tr></table>
<p>Will push the changes to the default remote (<var>origin</var>).
Git will prevent you from pushing changes if the local and remote trees are
out of sync. Refer to and to sync the local tree.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">git remote add &lt;name&gt; &lt;url&gt;
</pre></td></tr></table>
<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>
<table><tr><td>&nbsp;</td><td><pre class="example">git push &lt;remote&gt; &lt;refspec&gt;
</pre></td></tr></table>
<p>Will push the changes to the <var>&lt;remote&gt;</var> repository.
Omitting <var>&lt;refspec&gt;</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">3.3 Finding a specific svn revision</a></h2>
<p>Since version 1.7.1 git supports <var>:/foo</var> syntax for specifying commits
based on a regular expression. see man gitrevisions
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">git show :/'as revision 23456'
</pre></td></tr></table>
<p>will show the svn changeset <var>r23456</var>. 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).
This commit can be checked out with
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">git checkout -b svn_23456 :/'as revision 23456'
</pre></td></tr></table>
<p>or for git &lt; 1.7.1 with
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">git checkout -b svn_23456 $SHA1
</pre></td></tr></table>
<p>where <var>$SHA1</var> is the commit hash from the <code>git log</code> output.
</p>
<a name="Server-Issues"></a>
<h1 class="chapter"><a href="git-howto.html#toc-Server-Issues">4. Server Issues</a></h1>
<p>Contact the project admins <a href="mailto:root@ffmpeg.org">root@ffmpeg.org</a> if you have technical
problems with the GIT server.
</p><div id="footer">
<p>
<font size="-1">
This document was generated by <em>Kyle</em> on <em>January 27, 2012</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.
</font>
<br>
</div></div>
</p>
</body>
</html>
</div>