Git

# To Start a Project use 'git init'
# Project
git init

# To add file or files to staging area on a branch
git add .

# To commit the changes
git commit -m "Message for the log"

# To see the status
git status

# To show all the branches
git branch -a

# To change to a new branch
git checkout {branch name}

# to create a branch named 'dev' and change to it
git checkout -b dev

# To merge a brach. example dev into master
git checkout master
git merge <branch name> 
# where <branch name> is the name of the branch that will be merged into the receiving branch.   

# To see the the commits
git log --oneline
git log --graph --decorate
git log

# To have a look at a past commit - Safe
git checkout {hash}
# To go back to normal origin
git checkout master

# To revert to something in the past - Still safe
git revert {hash}
# then add your message and save and quit

# To reset to a point back in time - Danger, Will Robinson!!!
git reset {hash} --hard

Last updated