OpenHatch git workflow: Difference between revisions

From OpenHatch wiki
Content added Content deleted
imported>Jacquiesue
(Created page with "Some guidelines on how to use git when working on openhatch = Getting a new clone of openhatch = Only need to do this once. Or if you want to start form scratch. It is also...")
 
imported>Jacquiesue
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Some guidelines on how to use git when working on openhatch
Some guidelines on how to use git when working on OpenHatch


= Getting a new clone of openhatch =
= Getting a new clone of OpenHatch =
Only need to do this once. Or if you want to start form scratch.
Only need to do this once. Or if you want to start form scratch.
It is also good (okay) to remove your <code>oh-mainline</code> directory
It is also good (okay) to remove your <code>oh-mainline</code> directory
and start over if you aren't sure the state of your openhatch repository.
and start over if you aren't sure the state of your OpenHatch repository.
#<code>$ git clone git://github.com/openhatch/oh-mainline.git</code>
#<code>$ git clone git://github.com/openhatch/oh-mainline.git</code>


= Committing a patch =
= Committing a patch =
#After you have already retreived your respository of code. And you have made some changes, now you need to submit your patch (that will contain your changes) for review to openhatch.
#After you have already retreived your respository of code and made some changes, now you need to submit your changes for review to OpenHatch.
##<code>git status</code>
##<code>$ git status</code> (make sure the right files are listed here)
##<code>git add <file(s)></code>
##<code>$ git add <file(s)></code>
##<code>git commit -m "Short message explaining your fix"</code>
##<code>$ git commit -m "Short message explaining your fix"</code>
###Note: If you want to submit everything listed in 'Unstaged changes' in <code>git status</code>, you can just do <code>$ git commit -a -m "Short message explaining your fix"</code>, and skip the previous two steps.
##<code>git log -p</code> (opens in less editor)
##<code>git format-patch origin/master</code>
##<code>$ git log -p</code> (opens in less editor)
###Note: This is just to help you verify that your commit took effect correctly. If it didn't, there were likely errors in one or more of the above steps.
#Now git any updates that may have occurred since you last did a <code>git clone</code> or a <code>git fetch</code>
##<code>git fetch</code>
##<code>$ git format-patch origin/master</code>
#Now fetch any updates that may have occurred since you last did a <code>git clone</code> or a <code>git fetch</code>
##<code>gitk</code>
##<code>git rebase origin/master</code>
##<code>$ git fetch</code>
##<code>git log</code>
##<code>$ git rebase origin/master</code>
##<code>$ git log</code>
###Note: This is just to help you verify that your commit took effect correctly. If it didn't, there were likely errors in one or more of the above steps.

= Submitting a patch =
Find your patch file that has been generated from the <code>git format-patch</code> command. In your current directory you can run
<code>ls -lrt</code> which will list your files in time-sort order. Listing the
newest modified files at the bottom. Look for the file similar to
<code>0002-Updated-the-default-case-for-people-search-AllTagsQu.patch</code>. This file
or these files will need to be added to the bug tracker... if we are still doing this.
The alternative is just using github, which some people are starting to look into.


Note: The <code>git log</code> and <code>gitk</code> commands aren't modifying your patch, these commands are run to track your changes, and see what state your patch is in, in comparison to the origin


= Other useful commands =
= Other useful commands =
Line 29: Line 38:


= Resources =
= Resources =
* http://help.github.com/git-cheat-sheets/
* http://gitref.org/
* http://git-scm.com/documentation

= See also =
* [[How to generate patches with git format-patch]]
* [[How we handle patches]]
[[Category:Hacking_OpenHatch]]
[[Category:Git_OpenHatch]]

Latest revision as of 01:22, 22 October 2012

Some guidelines on how to use git when working on OpenHatch

Getting a new clone of OpenHatch

Only need to do this once. Or if you want to start form scratch. It is also good (okay) to remove your oh-mainline directory and start over if you aren't sure the state of your OpenHatch repository.

  1. $ git clone git://github.com/openhatch/oh-mainline.git

Committing a patch

  1. After you have already retreived your respository of code and made some changes, now you need to submit your changes for review to OpenHatch.
    1. $ git status (make sure the right files are listed here)
    2. $ git add <file(s)>
    3. $ git commit -m "Short message explaining your fix"
      1. Note: If you want to submit everything listed in 'Unstaged changes' in git status, you can just do $ git commit -a -m "Short message explaining your fix", and skip the previous two steps.
    4. $ git log -p (opens in less editor)
      1. Note: This is just to help you verify that your commit took effect correctly. If it didn't, there were likely errors in one or more of the above steps.
    5. $ git format-patch origin/master
  2. Now fetch any updates that may have occurred since you last did a git clone or a git fetch
    1. $ git fetch
    2. $ git rebase origin/master
    3. $ git log
      1. Note: This is just to help you verify that your commit took effect correctly. If it didn't, there were likely errors in one or more of the above steps.

Submitting a patch

Find your patch file that has been generated from the git format-patch command. In your current directory you can run ls -lrt which will list your files in time-sort order. Listing the newest modified files at the bottom. Look for the file similar to 0002-Updated-the-default-case-for-people-search-AllTagsQu.patch. This file or these files will need to be added to the bug tracker... if we are still doing this. The alternative is just using github, which some people are starting to look into.


Other useful commands

  • git rebase -i origin/master -- to combine patches into one. after which re-run format-patch command. notice "-i"
  • git diff -p
  • git rm
  • git -u

Resources

See also