git commands
git commands
git log --follow --all filename ------------- used to see the no of commits for a
single file
git show commit_id --name-only ------------used to see all the commit details
along with the file name
git show commit_id --stat ---------------see the histroy of a file
(modifications, data add and deletion)
git commit --amend -m "message" --------------used to change the commit message
for a latest commit
git commit --amend --author "username <mail>" --------------- used to change the
author of latest commit
git commit --amend --no-edit --------------used to commit the changes with
previous commit
git reset --hard HEAD~1 ---------------------used to delete the latest
commit along with the changes
git reset --hard HEAD~3 --------------------used to delete the latest 3
commits along with the changes
git resert --soft HEAD~1 -----------------------used to delete only
commits but not actions/changes
git resert --soft HEAD~3 -------------------------------used to delete only
latest commits but not actions/changes
git revert commit_id ---------------------------------used to delete a
particular commit action and add a new commit for the change
git branch --------------------------------used to see the list of branches
git branch branch-name ---------------------to create a branch
git checkout branch-name ----------------------to switch one branch to another
git checkout -b branch-name ---------------------------used to create and switch
a branch at a time
git branch -m old-branch new-branch -------------------------used to rename a
branch