Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redate failed. #21

Open
lm2343635 opened this issue Oct 1, 2018 · 10 comments
Open

Redate failed. #21

lm2343635 opened this issue Oct 1, 2018 · 10 comments

Comments

@lm2343635
Copy link

➜  MGSelector git:(master) git redate -c 4
fatal: ambiguous argument 'HEAD~4..HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Git redate failed. Please make sure you run this on a clean working directory.
@us
Copy link

us commented Dec 12, 2019

Ping!

@luciusmagn
Copy link

I had the same issue

@lwerdna
Copy link

lwerdna commented Apr 1, 2021

same...

fatal: ambiguous argument 'HEAD~100..HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Git redate failed. Please make sure you run this on a clean working directory.

@Hu1buerger
Copy link

Same.

git reset --hard didn't work either

@nvhoang55
Copy link

"Make sure to run this on a clean working directory otherwise it won't work."
Mean that no untracked and edited files (not committed files) in the directory, I suggest that you should create a new branch with a clean working tree then try again.

@Hu1buerger
Copy link

@nvhoang55 i tried that too.

After reset --hard all files are at the committed state

@JazzJackrabbit
Copy link

JazzJackrabbit commented Feb 3, 2022

Managed to make this work by excluding the initial commit from the scope and running
git redate -c N-1
where N is the total number of commits in the repo.

@AmosSpark
Copy link

Managed to make this work by excluding the initial commit from the scope and running git redate -c N-1 where N is the total number of commits in the repo.

@JazzJackrabbit can you detail how you exclude the initial commit from the scope? And how will I go about this if I have upto say 40 commits?

@JazzJackrabbit
Copy link

@AmosSpark
Basically just by running the redate command for the total amount of commits minus one.
So if you have 40 commits, that would be git redate -c 39.
That should change everything you need beside the very first commit.

Then, if you also need to change the date on the first commit, you can use this script from #6:

git filter-branch --env-filter \
"if test \$GIT_COMMIT = '448827e9ef01bb245ccd3939bfbddc2681c6d9c8'
then
    export GIT_AUTHOR_DATE='Sun May 7 02:23:03 2017 +0000'
    export GIT_COMMITTER_DATE='Sun May 7 02:23:03 2017 +0000'
fi" && rm -fr "$(git rev-parse --git-dir)/refs/original/"

Hope this helps.

@AmosSpark
Copy link

@AmosSpark Basically just by running the redate command for the total amount of commits minus one. So if you have 40 commits, that would be git redate -c 39. That should change everything you need beside the very first commit.

Then, if you also need to change the date on the first commit, you can use this script from #6:

git filter-branch --env-filter \
"if test \$GIT_COMMIT = '448827e9ef01bb245ccd3939bfbddc2681c6d9c8'
then
    export GIT_AUTHOR_DATE='Sun May 7 02:23:03 2017 +0000'
    export GIT_COMMITTER_DATE='Sun May 7 02:23:03 2017 +0000'
fi" && rm -fr "$(git rev-parse --git-dir)/refs/original/"

Hope this helps.

Yea it does, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants