Re: The move to git commences!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I was talking a little with clumens about some git workflows and figured
it's worthwhile to point out some things that make working with git
nicer.  Vaguely wiki formatted so that I can more easily put some of
this up on the wiki later (or someone else can :)

=== Avoiding spurious merge commits ===
Much of the git documentation references using 'git pull' to update to
newer upstream.  This works, but will often introduce a "merge commit"
at the tip from merging upstream into your local changes.  A better
approach is to instead run
  git fetch && git rebase origin
This will grab the changes from upstream and then replay your local
changes on top.  There are some nice options to git-rebase (-i to pick
and choose) as well.  See the man page :)

=== Stashing WIP changes to update ===
When working on one thing, you may find that there's a fix someone else
committed that you need but you're not yet ready to commit your change.
For this case, you can run 'git-stash' and then update your local tree.
After updating (with git fetch && git rebase origin as above), you can
reapply your changes with 'git-stash apply'

=== Keeping a directory per branch ===
If you've been doing the "directory per branch" approach of keeping
copies of the CVS trees, you can do similar with git and get some space
savings.  First, get your initial clone
  git clone git://git.fedoraproject.org/hosted/anaconda.git
Now, make a copy of the rhel5 branch referencing your main tree
  git clone --reference anaconda git://git.fedoraproject.org/hosted/anaconda.git rhel5
  cd rhel5
  git branch --track rhel5-branch origin/rhel5-branch 
  git checkout rhel5-branch

Doing this will help keep your space needs for multiple trees down

=== Cherry picking changes across branches ===
Often, there's a need to take a change and commit it across multiple
branches.  git-cherry-pick with a commit hash will let you grab a commit
and include it on your local branch

=== Looking at what's been committed ===
gitweb is nice for looking at commits, but web sites are laggy.  It's
nice to be able to look locally at history.  There's gitk, but I'm
morally opposed to the use of tk ;)  tig is pretty nice as a text-based
way to view the repo history, though.  There's also giggle, but it's
development has stalled a bit and it's not as helpful at this point

Jeremy

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux