Git Commands

1 min read

The following are those CLI commands from Git that I tend to forget specially after long periods without using them, so in order to avoid that uncomfortable feeling of not remember them when I need to implement something quickly I’ll put every single one here to find them easily.

Add a fresh local repo to a remote one:

Git Commands
git init
git remote add origin git@gitlab.com:rootpass/myRepository.git
git push -u origin main

Create, select and upstream to remote a new branch:

Git Commands
git branch myBranch
git select myBranch
git push -u origin myBranch

Delete local and remote branches:

Git Commands
git branch -d myBranch
git push origin -delete myBranch

Create tag (annotated or lightweight):

Git Commands
git tag -a myTag -m 'V1.0'
git tag myTag

Upstream tag (one tag or several tags):

Git commands
git push origin myTag
git push origin -tags

Delete local or remote tag:

Git commands
git tag -d myTag
git push origin -delete myTag
My avatar

Thanks for reading my blog post! Feel free to check out my other posts or contact me via the social links in the footer.


More Posts