Friday , 24 May 2019
Breaking News

GIT commands Cheat Sheet

Clone Master Repo:

#mkdir /path/to/your/project
#cd /path/to/your/project
#git init
#git remote add origin https://username@<gitserver>/group/puppet.git
#git pull origin master

 Setup Global Configs

#git config --global user.name "User Name"
#git config --global user.email "email@email.com"

Make changes and push

#echo "# This is my TEST" >> test.out
#git add test.out
#git commit -am "First Commit. Adding a TEST."
#git push -u origin master

 Push your whole folder to Master (To be done only once to setup the repo)

#git commit -m "Adding all files to repo"
#git add .  <= Its a dot at the end
#git push

Create Branch and Switch to it

#git checkout -b branchname

Switch back to Master or which branch

#git checkout master
#git checkout used_test_branch

Edit a File and Commit Changes

#git commit -a -m 'added a new tester'

Merge Branch into Master

#git checkout master
#git merge branchname

Delete a branch

#git branch -d branchname
#git branch rm branchname

 check the status

#git status

 Color code the git UI on the linux box

#git config --global color.ui true

Leave a Reply