I have to checkout a remote Git branch: foo/bar. This branch had a single commit (made at datetime A) which has been squashed (at datetime B).
Problem: once checked-out, I see the old commit (with datetime A), not the new one.
git pull --force doesn't help me. I also tried to delete my local branche, fetch, check-out, pull.
Asked
Active
Viewed 514 times
1

Jonathan Lermitage
- 669
- 1
- 5
- 17
-
what do you mean "`git pull --force` doesn't help me" ? Do you have an error message ? how do you know there is a squashed commit B instead of the A commit ? Someone told you, or did you see the discrepancy by looking at your local "origin/foobar" branch ? – Pac0 Aug 23 '17 at 14:18
-
2Is it just the datetime that is wrong? i.e. are the contents of the commit correct? I haven't looked closely at git squash, but I know that if you `git --amend` then it leaves the timestamp and author untouched – Matt Slonetsky Aug 23 '17 at 14:20
-
no error: it simply doesn't change anything. And yes, the author told me he squashed his commit. – Jonathan Lermitage Aug 23 '17 at 14:20
-
Ok, I'll check files to see if it's up to date. Thx. – Jonathan Lermitage Aug 23 '17 at 14:22
-
You are right, content is actually up to date. Also, I used SmartGit to show git log: it indicates something like "commit at datetime A (changed at datetime B)". So, it seems ok. – Jonathan Lermitage Aug 23 '17 at 14:25
1 Answers
2
From the documentation on rewriting history:
s, squash = use commit, but meld into previous commit
By default, during an interactive rebase, if you meld the commit messages together during a squash the commit timestamp and author on the original commit (the one you're melding into) are left unchanged. If you want to update these, then select edit
instead of pick
for the base commit.
This will then stop the rebase on that commit, giving you the chance to git commit --amend
and update meta information about the commit.
Here's a related answer dealing with modifying the dates of previous commits if you want that information to be updated.

Matt Slonetsky
- 306
- 1
- 7