- Clone repository.
git clone <git repo url> <target folder>
- Clone specific branch, latest commit only
git clone -b <branch name> --single-branch --depth 1 <git repo url> <target folder>
- Adding more depth after #2
git fetch --depth=2
- 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