Differences between revisions 3 and 4
Revision 3 as of 2010-09-06 08:56:10
Size: 705
Editor: SamatJain
Comment:
Revision 4 as of 2011-10-14 23:59:08
Size: 1149
Editor: SamatJain
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
== Workflow for gitorious and github ==

Initial checkout:

{{{#!highlight sh
# Fork repo on gitorious/github
# Pull repo from gitorious/github
# Add remote for upstream, e.g.
cd Spoon-Knife
git remote add upstream git://github.com/octocat/Spoon-Knife.git
git fetch upstream
}}}

When needing to merge upstream changes back into master:

{{{#!highlight sh
git fetch upstream
git merge upstream/master
}}}

== Cookbook ==

Workflow for gitorious and github

Initial checkout:

   1 # Fork repo on gitorious/github
   2 # Pull repo from gitorious/github
   3 # Add remote for upstream, e.g.
   4 cd Spoon-Knife
   5 git remote add upstream git://github.com/octocat/Spoon-Knife.git
   6 git fetch upstream

When needing to merge upstream changes back into master:

   1 git fetch upstream
   2 git merge upstream/master

Cookbook

Reverting changes

Amend the previous commit that has not been propogated (i.e. undo it, then start a new one with the pending changes in the index):

git commit --amend -a -m "New commit message"

Undo a commit that has not been propagated:

git reset --hard HEAD^

Once a commit that has been propagated, there is no way to undo. However, the following will create a new commit undoing the previous commit's changes:

git revert HEAD

Pull with rebase instead of merge

git pull --rebase

Configure a branch to always do a rebase instead of a merge:

git config branch.master.rebase true


CategoryCheatSheet

SamatsWiki: CheatSheet/Git (last edited 2023-03-01 08:30:42 by SamatJain)