Git commit --amend

You can modify the most recent commit in the same branch by running git commit --amend. This command is convenient for adding new or updated files to the previous commit. It is also a simple way to edit or add comments to the previous commit.

Git rebase

Rebasing is the process of taking all the changes that were committed on one branch and applying them to a new branch.

Run git rebase and add in the -i option to rewrite, replace, delete, and merge individual commits in the history. You can also:

Git cherry pick

You can apply an existing commit from another branch to the current branch within the repository by using the git cherry-pick command. Cherry-picking allows you to:

Git merge --squash

Squashing is the process of merging multiple commits into a single commit.

If you run git merge and the --squash option, a new commit will group all of the commits from that branch together. The commit will be used to merge into the current branch.