Last active
April 17, 2020 11:42
-
-
Save sangeeths/9066930 to your computer and use it in GitHub Desktop.
Some of the most frequently required Git commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List of pending commits to be pushed from local to remote repo | |
-------------------------------------------------------------- | |
git log origin/master..HEAD | |
git diff origin/master..HEAD | |
git diff origin/feature_branch..HEAD | |
Branch commands: | |
---------------- | |
git branch list all the branches in the local machine | |
git branch -a list all the branches (local + remote) | |
git branch -av list all the branches (local + remote) with comments | |
git checkout -b <branch> <from> create a branch <branch> from <from> | |
Creating a feature branch (from integration) and pushing it to remote repo: | |
--------------------------------------------------------------------------- | |
git checkout integration | |
git checkout -b feature_branch integration | |
git push origin <branch> | |
Remove untracked branches in the remote repo: | |
--------------------------------------------- | |
git fetch --prune | |
Remove untracked files and dirs: | |
-------------------------------- | |
git clean -f -d --dry-run do a dry run before to see the list of affected files/dirs | |
git clean -f clean untracked files | |
git clean -d -f clean untracked files and directories | |
git ls-files list only the tracked files |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment