Last active
July 13, 2021 20:49
-
-
Save creativeworkx/bacb73f1172cd2959fde11049c8c46a7 to your computer and use it in GitHub Desktop.
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
# | |
# git commands | |
# | |
Update on Windows | |
------------------ | |
git update-git-for-windows | |
Push branch to remote repository | |
-------------------------------- | |
git push origin branchname | |
Push all branches to remote repository | |
-------------------------------------- | |
git push origin --all | |
Push tag to remote repository | |
------------------------------ | |
git push origin tagname | |
List branches | |
------------- | |
git branch -a | |
Delete branch local | |
-------------------- | |
git branch -d branchname | |
Delete branch remote | |
--------------------- | |
git push origin :branchname | |
Rename branch local | |
-------------------- | |
git branch -m oldbranchname newbranchname | |
Delete tag local | |
------------------ | |
git tag -d tagname | |
Delete tag remote | |
------------------ | |
git push --delete origin tagname | |
Switch to branch | |
------------------ | |
git checkout branchname | |
Merge branch into current branch | |
-------------------------- | |
git merge branchname | |
Diff two branches | |
------------------ | |
git diff branchnameone branchnametwo | |
Remove folder from git, but leave filesystem folder untouched | |
------------------------------------------------------------- | |
git rm -r --cached foldername | |
delete all branches on origin that are already merged | |
----------------------------------------------------- | |
$ git branch -r --merged | grep -v master | sed 's/origin\///' | xargs -n 1 git push --delete origin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment