<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://xfs.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nahoo</id>
	<title>xfs.org - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://xfs.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nahoo"/>
	<link rel="alternate" type="text/html" href="https://xfs.org/index.php/Special:Contributions/Nahoo"/>
	<updated>2026-04-20T15:08:51Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://xfs.org/index.php?title=XFS_git_howto&amp;diff=1991</id>
		<title>XFS git howto</title>
		<link rel="alternate" type="text/html" href="https://xfs.org/index.php?title=XFS_git_howto&amp;diff=1991"/>
		<updated>2009-03-25T21:18:35Z</updated>

		<summary type="html">&lt;p&gt;Nahoo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Where is it? ==&lt;br /&gt;
&lt;br /&gt;
A git server is setup on oss.sgi.com which is serving&lt;br /&gt;
out of /oss/git.  A user, git, has been setup with the home directory&lt;br /&gt;
of /oss/git.  The xfs trees are located under /oss/git/xfs.  The main&lt;br /&gt;
development tree is a bare repository under /oss/git/xfs/xfs.git.  (So it&lt;br /&gt;
has no checked out files just the .git database files at the top&lt;br /&gt;
level) So far, it has a master, a mainline and an xfs-dev branch.&lt;br /&gt;
The master branch is used for the checking in of development, it&lt;br /&gt;
is mainline+latest XFS. xfs-dev will be set up to track ptools,&lt;br /&gt;
checkins are currently closed to that branch.&lt;br /&gt;
&lt;br /&gt;
For detailed information about the current available git trees, please see &lt;br /&gt;
[[Getting the latest source code]].&lt;br /&gt;
&lt;br /&gt;
== Checking out a tree: ==&lt;br /&gt;
    $ git clone git+ssh://oss.sgi.com/oss/git/xfs/xfs/&lt;br /&gt;
( for local trees you can use the path directly, if the machine is&lt;br /&gt;
running a git-daemon you can use git://, but that will not&lt;br /&gt;
auto-setup push syntax )&lt;br /&gt;
&lt;br /&gt;
this will clone the tree (all the commit objects), and checkout&lt;br /&gt;
the HEAD branch (master for our case, other branches can be seen&lt;br /&gt;
with git branch -a, to checkout a branch (local or remote) just&lt;br /&gt;
use:&lt;br /&gt;
    $ git checkout $branch&lt;br /&gt;
&lt;br /&gt;
== Tree Status: ==&lt;br /&gt;
    $ git status # lists modified, unmerged and untracked files.&lt;br /&gt;
    $ git log    # shows all commited modifications&lt;br /&gt;
( you can use git log $remote/branch to see the log of a remote )&lt;br /&gt;
&lt;br /&gt;
== Modifying files before checkins: ==&lt;br /&gt;
no need to mark files for modification, git will find out&lt;br /&gt;
about them automagically, just edit them.&lt;br /&gt;
    $ git add file # add&lt;br /&gt;
    $ git rm file  # remove&lt;br /&gt;
&lt;br /&gt;
    Note: that if one uses &amp;quot;git-commit -a&amp;quot; or &amp;quot;git-finalize -a&amp;quot;&lt;br /&gt;
    then you don&#039;t have to add files which have been modified or&lt;br /&gt;
    deleted as git will detect them, you only have to add new files.&lt;br /&gt;
&lt;br /&gt;
== Commiting/checking in: ==&lt;br /&gt;
    $ git commit&lt;br /&gt;
From man page - useful options:&lt;br /&gt;
--------------------------------&lt;br /&gt;
    -a|--all::&lt;br /&gt;
    Tell the command to automatically stage files that have&lt;br /&gt;
    been modified and deleted, but new files you have not&lt;br /&gt;
    told git about are not affected.&lt;br /&gt;
&lt;br /&gt;
    --amend::&lt;br /&gt;
    Used to amend the tip of the current branch. Prepare the tree&lt;br /&gt;
    object you would want to replace the latest commit as usual&lt;br /&gt;
    (this includes the usual -i/-o and explicit paths), and the&lt;br /&gt;
    commit log editor is seeded with the commit message from the&lt;br /&gt;
    tip of the current branch. The commit you create replaces the&lt;br /&gt;
    current tip -- if it was a merge, it will have the parents of&lt;br /&gt;
    the current tip as parents -- so the current top commit is&lt;br /&gt;
    discarded.&lt;br /&gt;
&lt;br /&gt;
    -s|--signoff::&lt;br /&gt;
    Add Signed-off-by line at the end of the commit message.&lt;br /&gt;
&lt;br /&gt;
I do like to git commit -asm &amp;quot;Commit message&amp;quot;&lt;br /&gt;
--------------------------------&lt;br /&gt;
remember that a git commit, only commits to YOUR local tree, you&lt;br /&gt;
then need to push things over:&lt;br /&gt;
&lt;br /&gt;
General form is:&lt;br /&gt;
    $ git push git://uri/of/the/other/rep +refspec&lt;br /&gt;
    &lt;br /&gt;
    $ git push oss&lt;br /&gt;
&lt;br /&gt;
Where in xfs/.git/config it has the few lines:&lt;br /&gt;
&lt;br /&gt;
    [remote &amp;quot;oss&amp;quot;]&lt;br /&gt;
    url = ssh://oss.sgi.com/oss/git/xfs/xfs.git&lt;br /&gt;
    push = master&lt;br /&gt;
&lt;br /&gt;
(Or modify the config file using &amp;quot;git remote add&amp;quot; mentioned below)&lt;br /&gt;
&lt;br /&gt;
== Going back in history - changing one&#039;s mind ==&lt;br /&gt;
[the STUPID (ptools) way]&lt;br /&gt;
    $ git revert $mod&lt;br /&gt;
will introduce a new commit reverting $mod.&lt;br /&gt;
&lt;br /&gt;
[ the OH GOD WE ARE DISTRIBUTED way (for mods not pushed anyway)]&lt;br /&gt;
&lt;br /&gt;
if the mods to revert are the last n one:&lt;br /&gt;
    $ git reset HEAD^n&lt;br /&gt;
&lt;br /&gt;
if not (dangerous)&lt;br /&gt;
    $ git rebase -i $mod^1 # considered harmfull read documentation !&lt;br /&gt;
&lt;br /&gt;
Other related commands:&lt;br /&gt;
    $ git reset     # see doc for --hard&lt;br /&gt;
&lt;br /&gt;
== Tracking remote trees: ==&lt;br /&gt;
    $ git remote add $name $uri # adds a remote tracking&lt;br /&gt;
    $ git remote update         # updates all remotes&lt;br /&gt;
    $ git branch -a             # shows all accessible branches&lt;br /&gt;
                                  ( including remotes in the&lt;br /&gt;
                                    $remote_name/ namespace )&lt;br /&gt;
&lt;br /&gt;
    $ git checkout -b $local_branch_name --track $remote_name/$remote_branch&lt;br /&gt;
          # creates a tracked local branch, git will warn whenever the&lt;br /&gt;
            remote adds commits.&lt;br /&gt;
&lt;br /&gt;
== Publishing one&#039;s tree: ==&lt;br /&gt;
give shell access to your tree, use git+ssh://machine/path or&lt;br /&gt;
direct path&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
    $ sudo git-daemon --export-all --base-path=/srv/git --base-path-relaxed --reuseaddr --user-path=public_git&lt;br /&gt;
           # exports all git trees found under ~/public_git and /srv/git&lt;br /&gt;
&lt;br /&gt;
Or set up indetd etc.&lt;br /&gt;
&lt;br /&gt;
== Reviews and requesting them ==&lt;br /&gt;
=== Developer ===&lt;br /&gt;
==== From a git tree: ====&lt;br /&gt;
* publishes a git tree at git://dev/tree, containing his feature1 branch&lt;br /&gt;
* Requests a pull from the reviewer.&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
==== publishes a series of patches: ====&lt;br /&gt;
        $ git format-patch $since_head # create ordered patches since&lt;br /&gt;
                                         head $since_head, i.e. on&lt;br /&gt;
                                         branch linus-create-ea, I&#039;d&lt;br /&gt;
                                         $since_head would be linus/master&lt;br /&gt;
        $ git send-email --compose *.patch&lt;br /&gt;
&lt;br /&gt;
== Importing changes to our development tree ==&lt;br /&gt;
=== Reviewer - typically someone at SGI ===&lt;br /&gt;
==== From a git tree: ====&lt;br /&gt;
* Adds a remote locally called &amp;quot;dev&amp;quot;:&lt;br /&gt;
        $ git remote add dev git://dev/tree&lt;br /&gt;
&lt;br /&gt;
* Looks at the differences between his tree (dev) and feature1:&lt;br /&gt;
        $ git log HEAD...dev/feature1 # differences in both ways,&lt;br /&gt;
	      	  	       	        read man for more detail…&lt;br /&gt;
List patches of commits from HEAD or dev/feature1 but not in both&lt;br /&gt;
(A...B in one branch but not both)&lt;br /&gt;
(A..B in branch B but not in A)&lt;br /&gt;
&lt;br /&gt;
* Reviews the diffs: (-p adds commit change in patch form)&lt;br /&gt;
        $ git log -p dev/feature1..HEAD&lt;br /&gt;
&lt;br /&gt;
* For each commit he accepts, imports it to his tree, adding a&lt;br /&gt;
Signed-off-by: automatically:&lt;br /&gt;
&lt;br /&gt;
Whilst in our own development tree, cherry-pick from the remote&lt;br /&gt;
        $ git cherry-pick -s -e $commit # easily scriptable with git cherry &lt;br /&gt;
&lt;br /&gt;
* The only trick there is putting the description into our preferred format,&lt;br /&gt;
  with summary line with [XFS] prefix, body, and SGI-PV.&lt;br /&gt;
  I guess we&#039;ll need to do that manually.&lt;br /&gt;
&lt;br /&gt;
* Pushes it to tree git+ssh://oss.sgi.com/oss/git/xfs/xfs.git&lt;br /&gt;
        $ git push oss # if you&#039;ve set up tracking remotes correctly&lt;br /&gt;
&lt;br /&gt;
if not&lt;br /&gt;
          $ git push git://chook/xfs/xfs-dev &amp;lt;refspec&amp;gt; # read man…&lt;br /&gt;
&lt;br /&gt;
        of form: git push repository &amp;lt;refspec&amp;gt;&lt;br /&gt;
        where &amp;lt;refspec&amp;gt; of form:&lt;br /&gt;
          The canonical format of a &amp;lt;refspec&amp;gt; parameter is&lt;br /&gt;
          `+?&amp;lt;src&amp;gt;:&amp;lt;dst&amp;gt;`; that is, an optional plus `+`, followed&lt;br /&gt;
          by the source ref, followed by a colon `:`, followed by&lt;br /&gt;
          the destination ref.&lt;br /&gt;
          The local ref that matches &amp;lt;src&amp;gt; is used&lt;br /&gt;
          to fast forward the remote ref that matches &amp;lt;dst&amp;gt;.  If&lt;br /&gt;
          the optional plus `+` is used, the remote ref is updated&lt;br /&gt;
          even if it does not result in a fast forward update.&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
==== From emailed patches: ====&lt;br /&gt;
* From a plain patch:&lt;br /&gt;
      $ git apply $patch # evil&lt;br /&gt;
* From a mailbox:&lt;br /&gt;
      $ git am -s $mailbox # the way to go, adds Signed-off-by&lt;br /&gt;
&lt;br /&gt;
In order to modify the commit description, it may work to apply the committed&lt;br /&gt;
patches in another branch and then &amp;quot;cherry-pick -e&amp;quot; them into the development&lt;br /&gt;
branch.&lt;br /&gt;
&lt;br /&gt;
== Lost your quilt ? ==&lt;br /&gt;
Hope you use underwear.&lt;br /&gt;
&lt;br /&gt;
if not, you can look at many projects made of awesome:&lt;br /&gt;
=== guilt (written by Jeffpc, an XFS hacker): ===&lt;br /&gt;
quilt for git; similar to Mercurial queues Guilt (Git Quilt) is a&lt;br /&gt;
series of bash scripts which add a Mercurial queues-like&lt;br /&gt;
functionality and interface to git.  The one distinguishing&lt;br /&gt;
feature from other quilt-like porcelains, is the format of the&lt;br /&gt;
patches directory. _All_ the information is stored as plain text&lt;br /&gt;
- a series file and the patches (one per file). This easily lends&lt;br /&gt;
itself to versioning the patches using any number of of SCMs.&lt;br /&gt;
&lt;br /&gt;
=== stgit: ===&lt;br /&gt;
manage stacks of patches in a git repository stgit provides&lt;br /&gt;
similar functionality to quilt (i.e. pushing/popping patches&lt;br /&gt;
to/from a stack) on top of git.&lt;br /&gt;
&lt;br /&gt;
These operations are performed using git commands and the patches&lt;br /&gt;
are stored as git commit objects, allowing easy merging of the&lt;br /&gt;
stgit patches into other repositories using standard git&lt;br /&gt;
functionality.&lt;br /&gt;
&lt;br /&gt;
Homepage: http://www.procode.org/stgit/&lt;br /&gt;
&lt;br /&gt;
=== topgit ===&lt;br /&gt;
(house favourite, we may want to impose this one, but needs&lt;br /&gt;
a bit of git knowledge to fully understand):&lt;br /&gt;
&lt;br /&gt;
a Git patch queue manager TopGit manages a patch queue using Git&lt;br /&gt;
topic branches, one patch per branch. It allows for patch&lt;br /&gt;
dependencies and can thus manage non-linear patch series.&lt;br /&gt;
&lt;br /&gt;
TopGit is a minimal layer on top of Git, which does not limit use&lt;br /&gt;
of Git&#039;s functionality (such as the index). It rigorously keeps&lt;br /&gt;
history until a patch is accepted upstream. It is also fully&lt;br /&gt;
usable across distributed repositories.&lt;br /&gt;
&lt;br /&gt;
Homepage: http://repo.or.cz/w/topgit.git&lt;/div&gt;</summary>
		<author><name>Nahoo</name></author>
	</entry>
</feed>