git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git pull --rebase and losing commits
@ 2009-11-02 12:26 Peter Krefting
  2009-11-02 15:04 ` Thomas Rast
                   ` (2 more replies)
  0 siblings, 3 replies; 38+ messages in thread
From: Peter Krefting @ 2009-11-02 12:26 UTC (permalink / raw)
  To: Git Mailing List

Hi!

I have put my web site under Git control, and am running into some problems.

Whenever I push changes, I go via a bare repository, which then is pulled 
into a checked out tree in my "public_html" directory. However, some scripts 
I have does create files directly under the "public_html", and some of them 
I want to push into the Git history.

I am trying to use --rebase everywhere to get a linear history in the cases 
where I have pushed changes to the bare repository while there were 
uncommited changes to the public_html directory.

I have come up with a script that does this (I have removed the 
uninteresting non-git commands):

  # Commit local changes
  git add path/to/script/output/*
  for file in $(git diff-index --cached --name-only HEAD); do
   havenew=1
  done
  if [ $havenew = 1 ]; then
   git commit --quiet -m 'Automatic' path/to/script/output/*
  fi

  # Update tree (--strategy=ours avoids merge conflicts)
  git pull --rebase --strategy=ours origin master

  # Push rebased local changes
  git push origin master

  # Update all references
  git fetch origin master:remotes/origin/master

However, this seems to lose commits. When I ran it today, it commited an 
automatic change, and then pulled a tree that did not contain that change, 
making the changed file just disappear. I had to dig through the reflog to 
find it:

- This is the auto-commit:
   608b7eda553552841f4a16167c680fc74ed3c55a 
509926edd306bb2f09f563a7cfda800a4f0fdaed Peter Krefting 
<peter@softwolves.pp.se> 1257162580 +0100      commit: Automatisk 
bloggkommentarsuppdatering

- This is the "git pull":
   509926edd306bb2f09f563a7cfda800a4f0fdaed 
9088bd4801a9008fe3fca0d351f97544cee014f1 Peter Krefting 
<peter@softwolves.pp.se> 1257162583 +0100      rebase finished: 
refs/heads/master onto 9088bd4801a9008fe3fca0d351f97544cee014f1

The history of 9088bd... does not contain the rebased version of 509926..., 
it just went missing.

I guess I am missing something vital here.

  $ git --version
  git version 1.5.6.5

-- 
\\// Peter - http://www.softwolves.pp.se/

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2009-11-16 23:06 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-02 12:26 git pull --rebase and losing commits Peter Krefting
2009-11-02 15:04 ` Thomas Rast
2009-11-02 21:34   ` Nanako Shiraishi
2009-11-02 15:10 ` Björn Steinbrink
2009-11-03  7:01   ` Peter Krefting
2009-11-03  9:52     ` Johannes Schindelin
2009-11-03 10:12       ` Peter Krefting
2009-11-11 14:03       ` [PATCH] Clarify documentation on the "ours" merge strategy Peter Krefting
2009-11-11 15:13         ` Baz
2009-11-11 20:35           ` Thomas Rast
2009-11-11 20:54             ` Baz
2009-11-11 21:02             ` Junio C Hamano
2009-11-11 21:30               ` [PATCH] " Nicolas Sebrecht
2009-11-11 23:37                 ` Thomas Rast
2009-11-12  7:55                   ` Junio C Hamano
2009-11-12  9:41                     ` Peter Krefting
2009-11-14  2:12                       ` Nanako Shiraishi
2009-11-15  9:10                         ` Junio C Hamano
2009-11-16  8:20                           ` Peter Krefting
2009-11-12  9:55                     ` Björn Steinbrink
2009-11-15 18:25                     ` [PATCH 0/3] Document and refuse rebase -s ours Thomas Rast
2009-11-15 18:25                       ` [PATCH 1/3] Documentation: clarify 'ours' merge strategy Thomas Rast
2009-11-15 18:25                       ` [PATCH 2/3] rebase docs: clarify --merge and --strategy Thomas Rast
2009-11-15 21:05                         ` Junio C Hamano
2009-11-15 21:11                           ` Thomas Rast
2009-11-15 18:25                       ` [PATCH 3/3] rebase: refuse to rebase with -s ours Thomas Rast
2009-11-15 18:39                         ` Sverre Rabbelier
2009-11-15 18:44                           ` Thomas Rast
2009-11-16 12:35                         ` Johannes Schindelin
2009-11-16 19:57                           ` Junio C Hamano
2009-11-16 21:25                             ` Johannes Schindelin
2009-11-16 21:45                               ` Junio C Hamano
2009-11-16 22:04                                 ` Sverre Rabbelier
2009-11-16 23:04                               ` A Large Angry SCM
2009-11-15 21:04                       ` [PATCH 0/3] Document and refuse rebase " Junio C Hamano
2009-11-15 21:13                         ` Thomas Rast
2009-11-03 10:12     ` git pull --rebase and losing commits Thomas Rast
2009-11-03  4:27 ` Randal L. Schwartz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).