Important command for git

1-git add .
2. git commit -m"commit-message"
3. git status
4. git checkout A → To switch to branch with name A
5. git branch -D A → Delete the branch with name A
6. git branch A → Create a branch with name A from the current branch
7. git checkout -b A → To create a new branch called A from current branch and switch to it
8. git commit --amend -m"new-commit-message" → To edit the commit message of your last commit. This is only recommended if you haven’t pushed your commit to remote.
9. git reset --soft HEAD~1 → This will revert your last commit without removing the changes. (The changes will come in unstaged form.)This is only recommended if you haven’t pushed your commit to remote.
10. git log → To explore the history of your current branch

1 Like