git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Default behavior of git pull

From
Bagas Sanjaya <bagasdotme@gmail.com>
Date
May 31, 2021, 11:27 UTC
Message-ID
<92682abb-3062-4613-399d-a3279afb8f0b@gmail.com>
In-Reply-To
<7a97ac78-f405-2dca-2998-f03637cc8255@gmail.com>
Hi Mathias,
On 31/05/21 16.18, Mathias Kunter wrote:
Show 19 quoted lines
> Wouldn't it make sense if "git pull" would by default also pull the 
> branch with the same name from the remote, in case no upstream is 
> configured?
> 
> If I can push to a remote with a simple "git push", then I'd also expect 
> to be able to pull from that same remote with a simple "git pull".
> 
> Does anything speak against this?
> 
> Example:
> 
>    git clone $url
>    git checkout -b fix-1
>    # do commits
>    git push           # push to origin/fix-1 (works)
>    git push origin    # push to origin/fix-1 (works)
>    # other people push to origin/fix-1
>    git pull           # pull from origin/fix-1 (fails)
>    git pull origin    # pull from origin/fix-1 (fails)

IME, I did git fetch first before I did git pull, unless I have repos that I didn't intentionally want to contribute to (just collecting them). When I choose to work, I always create a branch, then submit PR/patches from that against mainline.

Since you do centralized workflow like above, I advise you to integrate from remote with git fetch + git merge.

And you asked whether plain git pull can work. It is yes, provided that you don't do any local work on remote-tracking branches (such as mainline or hotfixes).

-- 
An old man doll... just what I always wanted! - Clara
Previous: Mathias KunterNext: Mathias Kunter
Message 2 of 4 in “Default behavior of git pull”
  1. Mathias KunterMay 31, 2021
  2. Bagas SanjayaMay 31, 2021
  3. Mathias KunterMay 31, 2021
  4. Felipe ContrerasJul 14, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.