How to use cherry-pick ?
How to use rebase ?
How to change the user name or the email of a commit ?
Cherry pick
Example:
#Checkout the branch you want to insert the commits
git checkout hotfix/Bug-123#Pick the commits
git cherry-pick 09c075bcd46af4bc94f1d2f8341b0b698506fc9c
#Push the branch
git push origin hotfix/Bug-123
Rebase
Merge multiple commits in to one
Example : Merge last 4 commits in to one
git rebase -i HEAD~4
# -> Change pick to squash the commit you want to merge
git push -f origin master
Change the user name or the email of a commit
Example 01git -c user.name="New name" -c user.email=new.email@mail.com commit --amend --reset-author
Example 02git commit --amend --author "New Author Name <email@address.com>"
Using Interactive Rebase (For multiple commits)
git rebase -i -p <some HEAD before all of your bad commits>
Then mark all of your bad commits as "edit" in the rebase file. If you also want to change your first commit, you have to manually add it as first line in the rebase file (follow the format of the other lines). Then, when git asks you to amend each commit, dogit commit --amend --author "New Author Name <email@address.com>"
edit or just close the editor that opens, and then dogit rebase --continue
to continue the rebase.
You could skip opening the editor altogether here by appending --no-edit so that the command will be:git commit --amend --author "New Author Name <email@address.com>" --no-edit && \
git rebase --continue
Update a branch from master or parent branch
git fetch
git rebase origin/master
Add new comment