Skip to content

goojoob/Git-commands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 

Repository files navigation

Git Cheat Sheet

Common git instructions i use in my day to day


Create local and remote Repository

first create .gitignore in the folder

git init

git add *

git commit -m "initial commit"

then create empty repository in <GitHub web>

<remote> is commonly named as origin

git remote add <remote> <github web>

git push --set-upstream <remote> main

git fetch

git pull

Stage and Commit

stage all changes in <directory>/<file>

git add <directory>/<file>/<regularexp>

commit staging

git commit -a

commit with <message> instead opening text editor

git commit -m <message>

display entire commit history

git log

Tagging versions

Annotated tag to a commit already done

git tag -a v1.4 -m "my version 1.4"
git tag v1.4

Show tags

git tag

Show tag version

git show v1.4

Do push after tagging

git push --tag

Delete local tagname

git tag -d tagname

Delete remote tagname

git push --delete origin tagname

Local and remote Branches

create local <branch>

git checkout -b <branch>

list all branches

git branch

push the <branch> to <remote>

git push <remote> <branch>

track the <branch>

git push --set-upstream <remote> <branch>

fetch and merge the remote branch into the local

git fetch
git pull

change current <branch>

git checkout <branch>

merge <branch> in the current

git merge <branch>

delete <branch> locally and remote

git branch -d <branch>

git push <remote> --delete <branch>

Clone existing repository

locate in the root folder, it will create a new folder

git clone https://github.com/goojoob/testing

About

Common git instructions

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published