Common Operations
Create a commit to save the changes you've made to your repository. This is the fundamental use of the command.
You provide a commit message to describe the changes you've made. A good commit message is clear, concise, and explains the purpose of the changes.
Before committing, you stage the changes you want to include in the commit using git add. This allows you to selectively choose which changes to include in the commit.
Using git commit -a or git commit --all you can commit all changes, including modified and deleted files, in a single command. However, it doesn't commit newly added files.
You can use git commit --amend to modify the most recent commit. This is useful for fixing mistakes in the commit message or adding changes you forgot to include.
If you have a small amount of changes and you want to include them in the previous commit, you can use the git commit --amend command with the --no-edit flag.
There is a simple procedure:
git addgit commit --amend --no-edit where the --no-edit specifying no edit to previous commit message.git commit --amend -m "<new msg>" to ammend to the previous with an upated commit message.git push
Make sure to push using
git push origin <branch-name> --force