Safety of using Git's filter-branch to rewrite if only modifications are to commits which haven't been pushed yet?

I'd cloned a repo and went along doing local commits before I noticed that I wasn't using the right email address or user name. Using this script here, I successfully ran the filter-branch and got the results I was looking for:

https://help.github.com/articles/changing-author-info

My theoretical understanding from posts here is that I can affect anything that hasn't been pushed, and not cause trouble for other people. That should be true, I think, even if I've been merging other people's commits from the master. But I'd like to make sure that theory lines up with practice in this very specific case!

Restated: If the only email address and user name records that were modified are the ones with my name that have never been pushed, is this safe? And am I correct in believing that it suddenly becomes unsafe if (for instance) I tried changing the email names in a commit which exists in the master?

Upvotes: 1

Views: 288

Answers (2)

VonC
VonC

Reputation: 1329302

After a git filter-branch, you can see the original commits in .git/refs/original.
See "how to remove old commits after filter-branch?" for more on that directory.

If none of those SHA1 were present in a remote repo, you are safe, and can push the modified repo whenever you want.

Upvotes: 1

Amber
Amber

Reputation: 527378

Yes. As long as you're only affecting commits that no one else has seen yet, you're fine.

Upvotes: 1

Related Questions