Re: More Beginning Git Questions

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

 



In message <1m2c90ds9e46c.7agk88pbgjl8$.dlg@xxxxxxxxxx>, tactical writes:

    Frans Klaver wrote:

    >> Mercurial allows this, and it's a very powerful feature.  After reading
    >> this thread, I could not believe Git didn't pulling with local changes,
    >> and so I tried it, and also asked on IRC -- and it seems that Git really
    >> doesn't.
    >
    > Git doesn't do it implicitly. Be explicit about it
    >
    > $ git stash
    > $ git pull
    > $ git stash pop
    >
    > seems to do exactly what you want.

    Does popping the stash allow for a three-way merge?  If not, this doesn't
    really solve the problem.

As I explained on IRC, you can use the following workflow to create a
three way merge.

git stash
git fetch
git merge @{u} stash
git mergetool
git stash drop

You can then do whatever other work you want.  You can repeat this
workflow as often as you want.  When you are done, then you can
commit:

git commit -a -m "My important work"

This is of course easily scriptable so it becomes one command to you.
And since you mentioned it, if the merge went poorly and you wanted to
start over (only before you dropped the stash of course), you can:

git reset --hard HEAD
git merge @{u} stash

And then continue with the rest of the workflow above.


Of course, I would recommend you consider some of the more gitish
workflows.  Commit early and often.  `git pull --rebase` as often as
you want, and then use `git rebase -i @{u}^` to squash all of your
in-progress commits together.  With appropriate in-progress commit
message crafting, you can use the --autosquash functionality of
git-rebase to make this process easier.

					-Seth Robertson
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]