|
Step - 1 : Set git user name and password, |
|
i) For setting globally, |
|
->Hit below commands |
|
git config --global user.name "FIRST_NAME LAST_NAME" |
|
git config --global user.email "MY_NAME@example.com" |
|
->Alternatively open ~/.gitconfig and add/edit the below information, |
|
[user] |
|
name = FIRST_NAME LAST_NAM |
|
email = MY_NAME@example.com |
|
ii) If you have multiple accounts in Gitlab, Github and using different ones for each of your local repository, you need to update for each repository, if it varies from the global ones. |
|
-> Open <PathToLocalRepo>/.git/config and add/edit the below information, |
|
[user] |
|
name = FIRST_NAME LAST_NAM |
|
email = MY_NAME@example.com |
|
|
|
Step - 2 : Resetting wrong author and commiter information for one/more commits of a branch. |
|
i) Checkout to local branch using below command |
|
git checkout <LocalBranchName> |
|
ii) Rebase local branch against origin |
|
git rebase -i origin <LocalBranchName> |
|
iii) An interactive vi editor will be opened and commits will be listed. |
|
For the commits you need to update the author and committer information, change the word "pick" to "edit". |
|
iv) Press `ESC` and enter ":wq" to save and exit the vi editor |
|
v) Hit the below commands consecutively until the rebase process is completed, |
|
git commit --amend --author="Thilakeswar <MY_NAME@example.com>" --no-edit |
|
git commit --amend --reset-author --no-edit |
|
git rebase --continue |
|
vi) Once rebased, hit "git log" to confirm the author and committer information change for each commit you intended. |
|
vii) Force push for the change to be reflected in remote as well. |
|
git push -f |