{"thread":{"id":"55809","subject":"Default behavior of git pull","startedAt":"2021-05-31T09:18:42Z","lastAt":"2021-07-14T15:31:41Z","messageCount":4,"participants":["Mathias Kunter","Bagas Sanjaya","Felipe Contreras"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"425992","messageId":"7a97ac78-f405-2dca-2998-f03637cc8255@gmail.com","threadId":"55809","inReplyTo":null,"subject":"Default behavior of git pull","fromName":"Mathias Kunter","fromEmail":"mathiaskunter@gmail.com","sentAt":"2021-05-31T09:18:31Z","receivedAt":"2021-05-31T09:18:42Z","isPatch":false,"sender":{"key":"mathiaskunter@gmail.com","avatar":"https://gravatar.com/avatar/131a813ba8d2cb36edb0d102971af5b523bad01aa9c842822e0d068b350bc4e8?d=mp&s=160"},"body":"Wouldn't it make sense if \"git pull\" would by default also pull the \nbranch with the same name from the remote, in case no upstream is \nconfigured?\n\nIf I can push to a remote with a simple \"git push\", then I'd also expect \nto be able to pull from that same remote with a simple \"git pull\".\n\nDoes anything speak against this?\n\nExample:\n\n   git clone $url\n   git checkout -b fix-1\n   # do commits\n   git push           # push to origin/fix-1 (works)\n   git push origin    # push to origin/fix-1 (works)\n   # other people push to origin/fix-1\n   git pull           # pull from origin/fix-1 (fails)\n   git pull origin    # pull from origin/fix-1 (fails)\n"},{"id":"425996","messageId":"92682abb-3062-4613-399d-a3279afb8f0b@gmail.com","threadId":"55809","inReplyTo":"7a97ac78-f405-2dca-2998-f03637cc8255@gmail.com","subject":"Re: Default behavior of git pull","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2021-05-31T11:27:01Z","receivedAt":"2021-05-31T11:27:09Z","isPatch":false,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"Hi Mathias,\n\nOn 31/05/21 16.18, Mathias Kunter wrote:\n> Wouldn't it make sense if \"git pull\" would by default also pull the \n> branch with the same name from the remote, in case no upstream is \n> configured?\n> \n> If I can push to a remote with a simple \"git push\", then I'd also expect \n> to be able to pull from that same remote with a simple \"git pull\".\n> \n> Does anything speak against this?\n> \n> Example:\n> \n>    git clone $url\n>    git checkout -b fix-1\n>    # do commits\n>    git push           # push to origin/fix-1 (works)\n>    git push origin    # push to origin/fix-1 (works)\n>    # other people push to origin/fix-1\n>    git pull           # pull from origin/fix-1 (fails)\n>    git pull origin    # pull from origin/fix-1 (fails)\n\nIME, I did git fetch first before I did git pull, unless I have repos \nthat I didn't intentionally want to contribute to (just collecting \nthem). When I choose to work, I always create a branch, then submit \nPR/patches from that against mainline.\n\nSince you do centralized workflow like above, I advise you to integrate \nfrom remote with git fetch + git merge.\n\nAnd you asked whether plain git pull can work. It is yes, provided that \nyou don't do any local work on remote-tracking branches (such as \nmainline or hotfixes).\n\n-- \nAn old man doll... just what I always wanted! - Clara\n"},{"id":"425998","messageId":"a5dfd06c-b3cf-2d30-2e57-d0706b75a908@gmail.com","threadId":"55809","inReplyTo":"92682abb-3062-4613-399d-a3279afb8f0b@gmail.com","subject":"Re: Default behavior of git pull","fromName":"Mathias Kunter","fromEmail":"mathiaskunter@gmail.com","sentAt":"2021-05-31T13:03:37Z","receivedAt":"2021-05-31T13:03:48Z","isPatch":false,"sender":{"key":"mathiaskunter@gmail.com","avatar":"https://gravatar.com/avatar/131a813ba8d2cb36edb0d102971af5b523bad01aa9c842822e0d068b350bc4e8?d=mp&s=160"},"body":"Hi Bagas,\n\nthanks for your reply.\n\n> Since you do centralized workflow like above, I advise you to integrate\n> from remote with git fetch + git merge.\n\nI'm aware of this. However, if I know that I didn't commit any changes \nto the local branch since I last pushed it (as in the given example), \nthen it should be possible to use a simple \"git pull\" IMHO.\n\nIt seems unnecessarily complex to me that users would have to use \"git \npull origin fix-1\" in this situation, when a simple \"git pull\" could \nalso work.\n\n\nAm 31.05.21 um 13:27 schrieb Bagas Sanjaya:\n> Hi Mathias,\n> \n> On 31/05/21 16.18, Mathias Kunter wrote:\n>> Wouldn't it make sense if \"git pull\" would by default also pull the \n>> branch with the same name from the remote, in case no upstream is \n>> configured?\n>>\n>> If I can push to a remote with a simple \"git push\", then I'd also \n>> expect to be able to pull from that same remote with a simple \"git pull\".\n>>\n>> Does anything speak against this?\n>>\n>> Example:\n>>\n>>    git clone $url\n>>    git checkout -b fix-1\n>>    # do commits\n>>    git push           # push to origin/fix-1 (works)\n>>    git push origin    # push to origin/fix-1 (works)\n>>    # other people push to origin/fix-1\n>>    git pull           # pull from origin/fix-1 (fails)\n>>    git pull origin    # pull from origin/fix-1 (fails)\n> \n> IME, I did git fetch first before I did git pull, unless I have repos \n> that I didn't intentionally want to contribute to (just collecting \n> them). When I choose to work, I always create a branch, then submit \n> PR/patches from that against mainline.\n> \n> Since you do centralized workflow like above, I advise you to integrate \n> from remote with git fetch + git merge.\n> \n> And you asked whether plain git pull can work. It is yes, provided that \n> you don't do any local work on remote-tracking branches (such as \n> mainline or hotfixes).\n> \n"},{"id":"430061","messageId":"60ef0352705ca_261120866@natae.notmuch","threadId":"55809","inReplyTo":"7a97ac78-f405-2dca-2998-f03637cc8255@gmail.com","subject":"RE: Default behavior of git pull","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2021-07-14T15:31:30Z","receivedAt":"2021-07-14T15:31:41Z","isPatch":false,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Hi Mathias,\n\nI hadn't seen this mail.\n\nMathias Kunter wrote:\n> Wouldn't it make sense if \"git pull\" would by default also pull the \n> branch with the same name from the remote, in case no upstream is \n> configured?\n\nI agree.\n\nIn fact, back in 2014 I wrote a builtin called `git update` to fix all\nthe problems with `git pull`. That command worked exactly as you\nsuggest.\n\nI recently sent a new proposal for `git update` [1] asking for feedback on\nhow different arguments should be handled. Nobody has suggested\nanything.\n\nFor the next iteration I will implement what you suggested, in my\nopinion it makes sense.\n\nCheers.\n\n[1] https://lore.kernel.org/git/20210705123209.1808663-1-felipe.contreras@gmail.com/\n\n-- \nFelipe Contreras\n"}]}