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

git subtree pull vs git pull

From
SKSven R. Kunze <srkunze@mail.de>
Date
Feb 18, 2021, 19:49 UTC
Message-ID
<988c57dd-58dc-8ec7-7b00-60313473277c@mail.de>
Hey everyone,

that's my first question here, so please bare with me. I got an unexplained behavior using git-subtree.

Please consider (git --version := 2.30.0):

me@host:~/repo$ git status On branch master Your branch is up to date with 'origin/master'.

Changes not staged for commit:
   (use "git add <file>..." to update what will be committed)
   (use "git restore <file>..." to discard changes in working directory)
         modified: somechanges
no changes added to commit (use "git add" and/or "git commit -a")

me@host:~/repo$ git pull --no-rebase Already up to date.

me@host:~/repo$ git subtree pull --prefix=prefix/ subtree-origin master Working tree has modifications.  Cannot add.

My expectation would be that I can pull the subtree as I could pull the main repo without any issue. The subtree does not even touch the modified file.

Is there a reason for this or can this restriction be lifted?

Where am I coming from? The work-around would be "git stash, git subtree pull, git stash pop" which would work on a first glance, but other tools like IDEs lose their context information regarding these changes (e.g. changelists). This can be a little bit annoying given that mostly there are not changes at the subtree-origin.

Best regards, Sven

Message 1 of 1 in “git subtree pull vs git pull”
  1. Sven R. KunzeFeb 18, 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.