Skip to content

Instantly share code, notes, and snippets.

@JaydipZala
Last active September 14, 2018 10:43
Show Gist options
  • Save JaydipZala/c475dd46bf9d47b01a10ec6c4080c99b to your computer and use it in GitHub Desktop.
Save JaydipZala/c475dd46bf9d47b01a10ec6c4080c99b to your computer and use it in GitHub Desktop.
Git basic commands
git init
git clone [repository url]
git remote add origin [repository url]
touch .gitignore
git add [path to file]
git add --all
git rm --cached [file path/pattern like .idea/*] -r
git commit -m [commit message] // commit stage files to local repository
git push origin master OR git push -u origin master // pushes local repository
git branch [branch name] // creates a branch
git branch // shows local repository branch list
git branch --remote // shows remote branch list
git checkout [branch name] // to swith between branch
git merge [branch name] // merge branch name to current workign branch
git branch -D [branch name] // deletes local branch
git push origin :[branch name] OR git push origin --delete [branch name]// deletes remote branch
git fetch origin [from branch name remote]:[to branch name local repository] // clone remote branch to local repo branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment