On Nov 1, 2014, at 3:44 AM, Gilles Gouaillardet <gilles.gouaillar...@gmail.com> wrote:
> Hi Dave, > > I am sorry about that, the doc is not to be blamed here. > I usually do pull/commit/push in a row to avoid this kind of things but i > screwed up this time ... > I cannot remember if i did commit/pull/push or if i simply forgot to pull Most of the time a "pull" won't succeed if you have uncommitted modifications your tree, so I'm not sure how pull/commit/push would actually work for you. Do you stash/unstash in the middle there? Or are you saying you make all of your changes between "pull" and "commit"? If so, there's always a race there that you might occasionally need to resolve with "git rebase" or "git pull --rebase" anyway. > btw, is there a push option to abort if that would make github history non > linear ? No, not really. There are some options to "pull" to prevent you from creating a merge commit, but the fix when you encounter that situation would simply be to rebase in some fashion, so you might as well just do that every time. The best thing to do is to just try to use "git pull --rebase" for any topic work (i.e., don't use a bare "git pull" unless you know that you need to perform a merge). A few other alternatives if you don't like that for some reason: 1. Set your "pull" default to perform a rebase. I don't recommend it because this can lead to confusion if you work on multiple systems and you are not 100% consistent about setting this behavior. But here's how to do it: http://stevenharman.net/git-pull-with-automatic-rebase 2. "git pull --rebase" can always be substituted by "git fetch ; git rebase". You could change your workflow to avoid the "pull" command altogether until it all makes more sense to you. Similarly, "git pull" (which means "git pull --no-rebase" by default) can always be substituted by "git fetch ; git merge". 3. View the commit graph before pushing to make sure you're pushing the history you think you should be. A helpful command for this (which you can alias if desired) is: git log --graph --oneline --decorate HEAD '@{u}' That will show the commit graph that can be traced back from your current branch and its tracked upstream branch. If you see a merge commit where you didn't expect one, fix the history before pushing. If you don't know how to fix it, ask the list or google around a bit. -Dave