Commit with GIT 101

  1. Open a terminal or command prompt and navigate to the directory of the local repository you wish to commit changes to.
  2. Run the command “git status” to view the current status of the repository, including any changes that have been made but not yet committed.
  3. 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.
  4. Run the command “git commit -m “[commit message]” to commit the changes with a message describing the changes made.
  5. Use the command “git log” to view the commit history and see the changes made.
  6. To push the committed changes to the remote repository, use the command “git push origin [branch name].”
  7. If you have made the wrong commit, you can use the command “git revert” to revert the changes made in the specific commit.
  8. 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.
  9. 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.