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

Remove email Id from the commit messages #3163

Closed
ghost opened this issue Dec 2, 2020 · 8 comments
Closed

Remove email Id from the commit messages #3163

ghost opened this issue Dec 2, 2020 · 8 comments

Comments

@ghost
Copy link

ghost commented Dec 2, 2020

Hi,

Due to signing-off the commits, my id has been exposed in commit messages.
Our company's Security team is asking me to remove my id from all the commits.
Is there a way to remove them?
Could you please guide me on this?
Thank you.

@LeoNerdoG
Copy link
Contributor

Hey @geetha-rangaswamaiah,
there is a way to simply not use your company e-mail if your company does not allow to use one or ask them to provide a generic one just for creating PRs on GitHub. AFAIK sign-off line is necessary in order to pass the ECA validation so there is no way around it.

@ghost
Copy link
Author

ghost commented Dec 2, 2020

Thank you @LeoNerdoG we will ensure this for our future PRs.
Is there a way to edit the email id in all my previous commits? I want to change signed-off by, from my email id to just username.
Like, "Signed-off-by: Geetha Rangaswamaiah < company email id >" to "Signed-off-by: Geetha Rangaswamaiah < geetha-rangaswamaiah >"

@LeoNerdoG
Copy link
Contributor

I don't know if I understand correctly you response above, but in any case you have to sign-off the commits with the same e-mail with which you have signed Eclipse ECA - you have to sign-off every commit with an e-mail, just signing-off commits with your name or acronym or anything else is not valid.
Otherwise GitHub will reject PRs, becasue Eclipse ECA has been signed with a different e-mail.

If you want to change the e-mail (and have no PRs open), this is fairly easy, just follow the steps below (I will not describe how to perform each step as you can find this on the web):

  1. Change your GitHub email from current one to new one, delete the old one (I once had some problems when my GitHub account contained old and new e-mail address)
  2. Change Eclipse e-mail from current one to new one
  3. Signe Eclipse ECA with the new e-mail
  4. Change your sign-off e-mail on your local machine (change git global confguration)
  5. After finishing work on a specific branch, squash all commits into one (if possible, otherwise squash them as much as you can), be carefull to not include old e-mail address from older commits (you should delete all sign-off lines except last one)
  6. Create a PR - and that's it!

I suggest that you finish your work on a specific branch (I don't know what your current objectives are), follow the steps above and create PR. If there will be problems, please do not close and reopen PR, just tag me in your PR and I will try to guide you through the process. I think that opening and closing PRs with almost no content is not very usefull 😄

If you have any more questions, please let me know.

@ghost
Copy link
Author

ghost commented Dec 3, 2020

Thank you very much @LeoNerdoG
I thought draft PRs will not notify you. Sorry about that.
I want to change the email id in the commits of all the PRs I've submitted till now that are already merged and the corresponding branches are deleted.
Like for example, in this PR #3042 I want to edit my email id in the commit signed-off-by field.
I hope this clarifies my query.

@LeoNerdoG
Copy link
Contributor

LeoNerdoG commented Dec 3, 2020

This might not be a very trivial thing to do, especially if you don't have the branches anymore.
There is a way, but it might mess up entire commit history.
I think it would be a lot easier for you to checkout a new branch from latest develop, then deleting the commits you have in git history, re-do the things you have done in previous commit(s) and adding new stuf, and then add everything in the new commit - this way you wont mess up git history (probably) and you can then add new sign-off as you please.

The flow would be:

  1. enter git log command and search for your commits (you have to count the commits - see next step)
  2. enter git rebase -i HEAD~[number of commits you want to rebase] (so if your commit is for example No. 192 in the history, you should type git rebase -i HEAD~192)
  3. Delete the commit you don't want it in the history
  4. Save changes without changing anything else
  5. Now procees to actually do some stuff on the branch, then adding and commiting things and creating new PR with all the changes.

As I am not a commiter on the project, I am adding @lorthirk and @Coduz to the thread. I generally think chaning the commit history is not a good idea, because...it is called a history for a reason. But if commiters on the project say it's OK or if we find another non-destructive wa to do this, even better.

@ghost
Copy link
Author

ghost commented Dec 3, 2020

Hi @LeoNerdoG I followed the steps but old commits are not modified or deleted in the repo(main branch). I can still see my old PRs with the old commit messages. (Tried with a dummy repo of mine)
I want my email id to be completely deleted/modified from all the commits I've done so far.
I understand that we've to sign-off every commit with an email id, so can we modify it in all my existing commits?

Say my old commit is

"Fix something. Signed-off-by: geetha < email id >"

Is it possible to modify this exact commit to

"Fix something. Signed-off-by: geetha < different email id >"

I don't want to create a new commit but want to edit the same commit, so that my email id will not be in any old commits or PRs or anywhere in the git history at all.

My point is to delete my email id from all my commits in the entire git history, so that it won't be visible to the public.

@LeoNerdoG
Copy link
Contributor

Hey @geetha-rangaswamaiah,
has this been resolved? Is there any progress on this?

As discussed above, this is not a trivial problem to solve and you might need help from the commiters on the project.
If you need additional help, please let us know.

@lorthirk
Copy link

Closing due to inactivity, and not being related to the project development.

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