I forked
a repo
. Worked on it and then submitted my pull request
. However, the repository owner wanted the commits to be squashed
. While squashing commits, I had many merge conflicts
. After squashing all the commits, now my PR shows "user B committed with user A"
, where user B
is the other guy
and user A
is me
. How can I remove that "user A commited with user B"
? How can I make the PR show only my commits instead of taking others and combining it? I tried various answers from stack overflow. This Removing <user> committed with <user> on Github might work for commits which are local. But I have already pushed everything.
Please help.
Asked
Active
Viewed 219 times
2

Zameer Haque
- 394
- 4
- 24
-
Are you quoting a commit message when you say `user B committed with user A` ? – Tim Biegeleisen Sep 22 '17 at 07:20
-
@TimBiegeleisen Yes, commit message. – Zameer Haque Sep 22 '17 at 07:23
1 Answers
3
Use git filter-branch
to change the author and the commiter.
Copy the following script and replace the following:
- 012345: Commit number
- Name Here: Your name (2 occurrences)
- email@here.com: Your email (2 occurrences)
git filter-branch --env-filter \
'if test "$GIT_COMMIT" = "012345"; then
export GIT_AUTHOR_NAME="Name Here"
export GIT_COMMITTER_NAME="Name Here"
export GIT_AUTHOR_EMAIL="email@here.com"
export GIT_COMMITTER_EMAIL="email@here.com"
fi' && rm -fr "$(git rev-parse --git-dir)/refs/original/"
Be careful: it will rewrite the history and you may have to use git push --force
if you already pushed.

Boris K
- 1,469
- 9
- 29
-
I deleted my answer and upvoted this because I don't believe `git commit --amend` has the ability to change the committer. I think we need `fitler-branch` for that. – Tim Biegeleisen Dec 19 '17 at 04:40