Git Commands to know

  1. Clone repository.
git clone <git repo url> <target folder>
  1. Clone specific branch, latest commit only
git clone -b <branch name> --single-branch --depth 1 <git repo url> <target folder>
  1. Adding more depth after #2
git fetch --depth=2
  1. Temporary Commits
# Roll back the commit: 
git reset --soft HEAD~1 
# (This removes the commit but keeps your changed files so you can edit them).
# Make your changes: Modify your files as needed.
# Stage and commit: 
git add . 
# Then git commit -m "Your new commit" Force-push: 
git push origin <branch-name> --force