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

Re: StGIT discards local commits on "stg pull"

From
CMCatalin Marinas <catalin.marinas@gmail.com>
Date
Feb 12, 2007, 09:31 UTC
Message-ID
<b0943d9e0702120131r528fb29ete143b8ce5a0a99e9@mail.gmail.com>
In-Reply-To
<20070212022625.rvyyo0kc0wowgogc@webmail.spamcop.net>
On 12/02/07, Pavel Roskin <proski@gnu.org> wrote:
Show 13 quoted lines
> I have been bitten by a strange bug/feature of StGIT, and it looks like
> it's not only counterintuitive, but also inconsistent with git.
>
> I have a repository available over ssh and I push to it from several
> places. Sometimes I make a commit and forget to push it.  Then I run "stg
> pull" to make sure my repository is up to date.
>
> The result is that the repository is rebased back to the last remote
> commit. It's very easy to miss.  There is no warning.  Everything looks
> just like an update from the remote.
>
> The example below shows that git-pull keeps my commit, but "stg pull"
> discards it by rebasing back to the remote ID.

I think this is a "feature" but we should've probably leave the original behaviour as the default. Maybe we should also have this per-branch rather than per-repository.

In StGIT 0.12, git-fetch is used by default rather than git-pull and StGIT performs the rebasing. We had some discussions on whether this would break existing workflows and we thought it wouldn't (I don't usually mix git-commit with stg commands).

The solution would be to define the following in your gitconfig file (either ~/.gitconfig or .git/config; a full example in StGIT's examples/gitconfig):

[stgit]
	pullcmd = git-pull
	pull-does-rebase = no

The last line would tell StGIT not to do the rebasing and let git-pull handle it.

I agree that for the rebasing case, we should have some warning if fast-forwarding of the stack's base is not possible so that you could run 'stg uncommit'.

-- 
Catalin
Previous: Pavel RoskinNext: Yann Dirson
Message 2 of 12 in “StGIT discards local commits on "stg pull"”
  1. Pavel RoskinFeb 12, 2007
  2. Catalin MarinasFeb 12, 2007
  3. Yann DirsonFeb 12, 2007
  4. Yann DirsonFeb 12, 2007
  5. Catalin MarinasFeb 19, 2007
  6. Pavel RoskinFeb 19, 2007
  7. Yann DirsonFeb 20, 2007
  8. Yann DirsonFeb 20, 2007
  9. Yann DirsonFeb 19, 2007
  10. Pavel RoskinFeb 13, 2007
  11. Catalin MarinasFeb 13, 2007
  12. Yann DirsonFeb 19, 2007

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.