Commit with GIT 101

- Open a terminal or command prompt and navigate to the directory of the local repository you wish to commit changes to.
- Run the command “git status” to view the current status of the repository, including any changes that have been made but not yet committed.
- Use the command “git add [file name]” to stage the changes you wish to commit. You can also use “git add .” to stage all changes in the current directory.
- Run the command “git commit -m “[commit message]” to commit the changes with a message describing the changes made.
- Use the command “git log” to view the commit history and see the changes made.
- To push the committed changes to the remote repository, use the command “git push origin [branch name].”
- If you have made the wrong commit, you can use the command “git revert” to revert the changes made in the specific commit.
- If you have made multiple commits and want to combine them, you can use the command “git squash” or “git merge” to squash the commits together.
- Once done with the commits, you can create a pull request on the GitHub website and merge it once the reviewers approve it.
It’s important to note that committing changes is a crucial step in the Git workflow, and it’s essential to ensure your commits are clear, concise, and informative.