mRagbir
12/7/2018 - 3:38 PM

Git Commands

Quick overview of Git Commands

git --version  // gets current version
touch fileName.extension // creates a file in the folder
git init // uses bash inside folder location

//credentials
git config --global user.name 'userName'
git config --global user.email 'email'

//Add file to Repo
git add fileName.extension

//Add everything from folder to staging area
git add .

//Remove a file from repo
git rm--cached fileName

//add all files with specific extension
git add * .extension

//commit everything in staging area
git commit

//Add everything from local repo to remote repo
git push

//Pull latest changes
git pull

//Clone a repo
git clone pathOfGitHubRepo

//Add a comment
git commit -m 'comment'

//Add ignore folder
touch .gitignore

//Add directory
git add .

//Create branch
git branch branchName

//Switch to branch in Bash
git checkout branchName

//Merge a branch
git merge 'branchName'

//See list of remote repo's
git remote

//Push application folder to GitHub
git push-u repoName master