Useful git commands

git remote show origin: shows the details about the remote repo from which local repo is cloned.

git checkout -b branch_name: creates a new branch in the local repo with the branch_name.

git push -u origin branch_name: pushes the changes made from the local repo to the remote repo of branch_name.

git config credential.helper store: stores the credentials so that you don’t have type username/password everytime you push.

git diff: to see all the changes after last commit.

git diff HEAD^ HEAD: see changes of the last commit.

 git reset –soft HEAD~n && git commit: merge last n commits into a single one.

git format-patch master –stdout > name.patch

git commit –amend: change the git commit message.

git reset HEAD~: undo the last commit.


Powered by

Up ↑

%d bloggers like this: