Why avoid `git pull` and what to do instead

Multi tool use
Multi tool use












1















In this comment,
@torek (reputation currently 172,509) said:




I actually recommend avoiding git pull entirely, for the same reason you recommend avoiding --autostash




The reason given for avoiding git rebase --autostash was:




It seems convenient when it works but is problematic when it doesn't




In which ways can git pull be problematic when it doesn't work?



My robust automated solution to avoiding git pull --autostash is non-trivial.



Is there a robust automated solution to avoiding git pull?










share|improve this question


















  • 1





    What does pull have to do with rebase --autostash? Also, remember a pull is just a fetch then a merge.

    – evolutionxbox
    Oct 18 '18 at 8:41











  • @evolutionxbox presumably it's a series of commands (stash push, rebase, stash pop / fetch merge) which can lose information (eg exit status). See the links for more context.

    – Tom Hale
    Oct 18 '18 at 9:17








  • 2





    "Robust" tends to be hard. Since pull = fetch + 2nd-git-command, run git fetch (which is pretty safe at all times assuming standard configurations), then build the robust part around whichever second command you want.

    – torek
    Oct 18 '18 at 15:28






  • 1





    Possibly relevant: adamcod.es/2014/12/10/git-pull-correct-workflow.html

    – chevybow
    Oct 18 '18 at 15:42











  • @chevybow Excellent, that was the answer I was after. Thanks!

    – Tom Hale
    Oct 19 '18 at 12:35
















1















In this comment,
@torek (reputation currently 172,509) said:




I actually recommend avoiding git pull entirely, for the same reason you recommend avoiding --autostash




The reason given for avoiding git rebase --autostash was:




It seems convenient when it works but is problematic when it doesn't




In which ways can git pull be problematic when it doesn't work?



My robust automated solution to avoiding git pull --autostash is non-trivial.



Is there a robust automated solution to avoiding git pull?










share|improve this question


















  • 1





    What does pull have to do with rebase --autostash? Also, remember a pull is just a fetch then a merge.

    – evolutionxbox
    Oct 18 '18 at 8:41











  • @evolutionxbox presumably it's a series of commands (stash push, rebase, stash pop / fetch merge) which can lose information (eg exit status). See the links for more context.

    – Tom Hale
    Oct 18 '18 at 9:17








  • 2





    "Robust" tends to be hard. Since pull = fetch + 2nd-git-command, run git fetch (which is pretty safe at all times assuming standard configurations), then build the robust part around whichever second command you want.

    – torek
    Oct 18 '18 at 15:28






  • 1





    Possibly relevant: adamcod.es/2014/12/10/git-pull-correct-workflow.html

    – chevybow
    Oct 18 '18 at 15:42











  • @chevybow Excellent, that was the answer I was after. Thanks!

    – Tom Hale
    Oct 19 '18 at 12:35














1












1








1


1






In this comment,
@torek (reputation currently 172,509) said:




I actually recommend avoiding git pull entirely, for the same reason you recommend avoiding --autostash




The reason given for avoiding git rebase --autostash was:




It seems convenient when it works but is problematic when it doesn't




In which ways can git pull be problematic when it doesn't work?



My robust automated solution to avoiding git pull --autostash is non-trivial.



Is there a robust automated solution to avoiding git pull?










share|improve this question














In this comment,
@torek (reputation currently 172,509) said:




I actually recommend avoiding git pull entirely, for the same reason you recommend avoiding --autostash




The reason given for avoiding git rebase --autostash was:




It seems convenient when it works but is problematic when it doesn't




In which ways can git pull be problematic when it doesn't work?



My robust automated solution to avoiding git pull --autostash is non-trivial.



Is there a robust automated solution to avoiding git pull?







git git-merge git-pull pull git-fetch






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Oct 18 '18 at 8:39









Tom HaleTom Hale

6,7064156




6,7064156








  • 1





    What does pull have to do with rebase --autostash? Also, remember a pull is just a fetch then a merge.

    – evolutionxbox
    Oct 18 '18 at 8:41











  • @evolutionxbox presumably it's a series of commands (stash push, rebase, stash pop / fetch merge) which can lose information (eg exit status). See the links for more context.

    – Tom Hale
    Oct 18 '18 at 9:17








  • 2





    "Robust" tends to be hard. Since pull = fetch + 2nd-git-command, run git fetch (which is pretty safe at all times assuming standard configurations), then build the robust part around whichever second command you want.

    – torek
    Oct 18 '18 at 15:28






  • 1





    Possibly relevant: adamcod.es/2014/12/10/git-pull-correct-workflow.html

    – chevybow
    Oct 18 '18 at 15:42











  • @chevybow Excellent, that was the answer I was after. Thanks!

    – Tom Hale
    Oct 19 '18 at 12:35














  • 1





    What does pull have to do with rebase --autostash? Also, remember a pull is just a fetch then a merge.

    – evolutionxbox
    Oct 18 '18 at 8:41











  • @evolutionxbox presumably it's a series of commands (stash push, rebase, stash pop / fetch merge) which can lose information (eg exit status). See the links for more context.

    – Tom Hale
    Oct 18 '18 at 9:17








  • 2





    "Robust" tends to be hard. Since pull = fetch + 2nd-git-command, run git fetch (which is pretty safe at all times assuming standard configurations), then build the robust part around whichever second command you want.

    – torek
    Oct 18 '18 at 15:28






  • 1





    Possibly relevant: adamcod.es/2014/12/10/git-pull-correct-workflow.html

    – chevybow
    Oct 18 '18 at 15:42











  • @chevybow Excellent, that was the answer I was after. Thanks!

    – Tom Hale
    Oct 19 '18 at 12:35








1




1





What does pull have to do with rebase --autostash? Also, remember a pull is just a fetch then a merge.

– evolutionxbox
Oct 18 '18 at 8:41





What does pull have to do with rebase --autostash? Also, remember a pull is just a fetch then a merge.

– evolutionxbox
Oct 18 '18 at 8:41













@evolutionxbox presumably it's a series of commands (stash push, rebase, stash pop / fetch merge) which can lose information (eg exit status). See the links for more context.

– Tom Hale
Oct 18 '18 at 9:17







@evolutionxbox presumably it's a series of commands (stash push, rebase, stash pop / fetch merge) which can lose information (eg exit status). See the links for more context.

– Tom Hale
Oct 18 '18 at 9:17






2




2





"Robust" tends to be hard. Since pull = fetch + 2nd-git-command, run git fetch (which is pretty safe at all times assuming standard configurations), then build the robust part around whichever second command you want.

– torek
Oct 18 '18 at 15:28





"Robust" tends to be hard. Since pull = fetch + 2nd-git-command, run git fetch (which is pretty safe at all times assuming standard configurations), then build the robust part around whichever second command you want.

– torek
Oct 18 '18 at 15:28




1




1





Possibly relevant: adamcod.es/2014/12/10/git-pull-correct-workflow.html

– chevybow
Oct 18 '18 at 15:42





Possibly relevant: adamcod.es/2014/12/10/git-pull-correct-workflow.html

– chevybow
Oct 18 '18 at 15:42













@chevybow Excellent, that was the answer I was after. Thanks!

– Tom Hale
Oct 19 '18 at 12:35





@chevybow Excellent, that was the answer I was after. Thanks!

– Tom Hale
Oct 19 '18 at 12:35












1 Answer
1






active

oldest

votes


















1














No need for avoiding git pull: since Git 2.9, type:



git config --global pull.rebase true
git config --global rebase.autoStash true


Then a simple git pull will do, in essence, what your better workflow is about: rebase if needed your current branch on top of the fetched origin/yourBranch.






share|improve this answer
























  • One reason to avoid doing this is given here, namely a 0 exit status even though the stash failed to reapply.

    – Tom Hale
    Dec 29 '18 at 23:14











  • @TomHale I agree, and have upvoted your script. I simply have not been confronted to that issue often enough.

    – VonC
    Dec 30 '18 at 7:55











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52870122%2fwhy-avoid-git-pull-and-what-to-do-instead%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














No need for avoiding git pull: since Git 2.9, type:



git config --global pull.rebase true
git config --global rebase.autoStash true


Then a simple git pull will do, in essence, what your better workflow is about: rebase if needed your current branch on top of the fetched origin/yourBranch.






share|improve this answer
























  • One reason to avoid doing this is given here, namely a 0 exit status even though the stash failed to reapply.

    – Tom Hale
    Dec 29 '18 at 23:14











  • @TomHale I agree, and have upvoted your script. I simply have not been confronted to that issue often enough.

    – VonC
    Dec 30 '18 at 7:55
















1














No need for avoiding git pull: since Git 2.9, type:



git config --global pull.rebase true
git config --global rebase.autoStash true


Then a simple git pull will do, in essence, what your better workflow is about: rebase if needed your current branch on top of the fetched origin/yourBranch.






share|improve this answer
























  • One reason to avoid doing this is given here, namely a 0 exit status even though the stash failed to reapply.

    – Tom Hale
    Dec 29 '18 at 23:14











  • @TomHale I agree, and have upvoted your script. I simply have not been confronted to that issue often enough.

    – VonC
    Dec 30 '18 at 7:55














1












1








1







No need for avoiding git pull: since Git 2.9, type:



git config --global pull.rebase true
git config --global rebase.autoStash true


Then a simple git pull will do, in essence, what your better workflow is about: rebase if needed your current branch on top of the fetched origin/yourBranch.






share|improve this answer













No need for avoiding git pull: since Git 2.9, type:



git config --global pull.rebase true
git config --global rebase.autoStash true


Then a simple git pull will do, in essence, what your better workflow is about: rebase if needed your current branch on top of the fetched origin/yourBranch.







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 28 '18 at 21:29









VonCVonC

834k29026263170




834k29026263170













  • One reason to avoid doing this is given here, namely a 0 exit status even though the stash failed to reapply.

    – Tom Hale
    Dec 29 '18 at 23:14











  • @TomHale I agree, and have upvoted your script. I simply have not been confronted to that issue often enough.

    – VonC
    Dec 30 '18 at 7:55



















  • One reason to avoid doing this is given here, namely a 0 exit status even though the stash failed to reapply.

    – Tom Hale
    Dec 29 '18 at 23:14











  • @TomHale I agree, and have upvoted your script. I simply have not been confronted to that issue often enough.

    – VonC
    Dec 30 '18 at 7:55

















One reason to avoid doing this is given here, namely a 0 exit status even though the stash failed to reapply.

– Tom Hale
Dec 29 '18 at 23:14





One reason to avoid doing this is given here, namely a 0 exit status even though the stash failed to reapply.

– Tom Hale
Dec 29 '18 at 23:14













@TomHale I agree, and have upvoted your script. I simply have not been confronted to that issue often enough.

– VonC
Dec 30 '18 at 7:55





@TomHale I agree, and have upvoted your script. I simply have not been confronted to that issue often enough.

– VonC
Dec 30 '18 at 7:55


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52870122%2fwhy-avoid-git-pull-and-what-to-do-instead%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







5dAQMlNoK Bwk84p5OqepIMtv83uAsBHOOOOQ65w2W3Fd85,KzEvRIXgXvw3QLSUMeoc,7,RIUA btVviX52bSZmhwQjKpwNl9 4XEO6
M79 oYDfox YExWu,EDZwEDbY6mggP9R5YZGvUK3dJ6z 2NY7NkSsTf8e3M84GwWfTFtHDMWXTDyI 4Bxf4C2

Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas