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

Error, fatal ambiguous argument #6

Open
vesche opened this issue May 14, 2017 · 7 comments
Open

Error, fatal ambiguous argument #6

vesche opened this issue May 14, 2017 · 7 comments

Comments

@vesche
Copy link

vesche commented May 14, 2017

I am trying to change the commit times on one of my projects. I merged a pull request from someone with a bad system time... git-redate doesn't seem to have a problem when editing a date from the last 5 commits. But, I'm trying to change some commits that are within the last 23 commits. I'm getting the following error (upon exiting vi):

$ git-redate -c 23
fatal: ambiguous argument 'HEAD~23..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.
@callaginn
Copy link

I'm getting the exact same error. I even added the two gitblah files to my global gitignore and checked the status of the repo before and during the git redate command.

@vesche Did you ever find an alternative way of doing this?

PCNAME:~ User$ cd /Sites/test
PCNAME:test User$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
PCNAME:test User$ git redate -c 12
fatal: ambiguous argument 'HEAD~12..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.

@vesche
Copy link
Author

vesche commented Jan 21, 2018

@callaginn Yes, I did. I had to change each commit manually, luckily I only had two bad commits.

Here's the stack overflow answer that helped me, I had to modify the answer a bit because it was for unpublished commits. Make sure you force the push.

And here's the personal note I took afterwards:

Change the time of a git commit

God this was a bitch, writing this down in case I need it again.

$ 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/"

$ git push -f origin master

Check out git log --since="3 months ago" to verify the changes.

@callaginn
Copy link

@vesche Haha...that does look irritating. I ended up finding it easier to just do it again, though, since I had already carefully documented all my backdated commits in a spreadsheet. Spent my entire last weekend on that stupid project : P

Git is complicated. Really don't understand why nobody's really created a visual interface for all this. Closest I've seen is GitUp, but it's lacking a ton of features: https://github.com/git-up/GitUp

@vesche
Copy link
Author

vesche commented Jan 27, 2018

@callaginn

Check out Github Desktop: https://desktop.github.com/

@callaginn
Copy link

@vesche Already using it. What I'm talking about is a git editor that allows you to do filter-branching, interactive-rebasing, tons of redos, etc in a visual drag-and-drop interface. Would do it myself...but I'm a front-end designer/developer, not a programmer.

I have found that the Atom editor can do some simple rewrites, though, if you haven't pushed anything yet. Otherwise, you're stuck with the command line.

@ghost
Copy link

ghost commented Jul 29, 2018

This happens when you go through or beyond the root commit.

Not sure how much finagling is required to accommodate the edge case.

@vesche
Copy link
Author

vesche commented Jul 29, 2018

@au That makes a lot of sense, I didn't even think about that. It was also my case that the author I merged commits from did so on a date before the root commit.

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

2 participants