[Freemint-list] Where is my commit?

Vincent Rivière vincent.riviere at freesbee.fr
Sat Jan 28 21:41:57 MSK 2017


On 28/01/2017 à 19:19, Helmut Karlowski wrote:
> When I committed to CVS I used a shell-script that fetches the
> descriptions from a file with the same name (or contains a list of files
> to commit at once).
>
> I want to keep that practice with git.

Oh. So indeed, that -F is the right option for you.

> So I can save one command by leaving the "add" out?

Yes. You discovered a new way (at least for me) to commit things :-)

>> git takes its default from somewhere (probably your /etc/passwd).
>
> ~/.gitconfig in this case.

So indeed, you already did "git config --global ..." some time ago.

> I edited the config-file. Should now be correct.

"git config --global ..." just changes ~/.gitconfig
Manually editing that file is also correct, so you're right.

> But my question was: how to change the contributer-name without
> reverting/re-pushing?
> Otherwise I'll just leave it as it is.

You want to change the history on GitHub. No mystery, you have to rewrite 
the history locally, and do a forced push.

The easiest solution to rewrite your *last* commit locally is "git commit 
--amend".

Step by step commands, to solve your issue
# Be sure you are on the right directory, and on the right branch
pwd
git branch

# Ensure the last commit is really the one you want to change
git show

# Change author name and e-mail in last commit
git commit --amend --author="Helmut Karlowski <helmut.karlowski at ish.de>" 
--no-edit

# Ensure that the result is correct
git show

# Force push to GitHub
git push -f

You're done.

Warning! "push -f" is a dangerous option, as it rewrites the history on 
GitHub. If misused, it can lead to data loss. Especially, deleting other 
people's work! But as far as you are alone on your branch, risks are limited.

-- 
Vincent Rivière


More information about the Freemint-list mailing list