# Git Commands ## git init initialize git and create a new local repository ## git add . track all the files in the local repo for changes ## git add filename track a specific file in the repo for changes ## git commit -m "first commit" -m "the description" take a snapshot of the files in the repo ## git status check the status of your code ## git remote add origin https-link add a new remote repository ## git push origin master push the local repository to github ## git push -u origin master push the local repository to github and also set upstream (enables you to use git push only in future) ## git branch check the current branch and available branches ## git checkout -b new-branch-name go to another new branch ## git checkout existing-branch switch to an existing branch ## git diff feature see the difference between files you want to merge ## git config --global user.name "[name]" Sets the name you want attached to your commit transactions ## git config --global user.email "[email address]" Sets the email you want attached to your commit transactions ## git config --global color.ui auto Enables helpful colorization of command line output ## git push use this cmd when pushing a new branch to see how it should be done ## git pull when upstream is set , to pull from github when changes made on the github and want them to reflect on local machine ## git pull origin master to pull from github when changes made on the github and want them to reflect on local machine ## git branch -d branch-name delete a branch ## git commit -am "message" commit and add at the same time
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter