git pull --rebase and losing commits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx> 1257162580 +0100 commit: Automatisk bloggkommentarsuppdatering

- This is the "git pull":
509926edd306bb2f09f563a7cfda800a4f0fdaed 9088bd4801a9008fe3fca0d351f97544cee014f1 Peter Krefting <peter@xxxxxxxxxxxxxxxx> 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/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]