Git Cheat Sheet - Git made easy

From Brian Nelson Ramblings
Revision as of 03:19, 16 January 2018 by Brian (Talk | contribs) (Created page with "==Git Cheat Sheet - Git made Easy== Setup your own accounts for version control, the two I like to use are - https://github.com/ - https://bitbucket.org ===Create and Clon...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Git Cheat Sheet - Git made Easy

Setup your own accounts for version control, the two I like to use are

- https://github.com/
- https://bitbucket.org

Create and Clone

Create New repository

git init

Clone local repository

git clone /path/to/repo

Clone remote repository

git clone  username@host:/path/to/repo

Add and Remove Files

Add Changes

git add <filename>

Add All Files

git add *

Remove/Delete Files

git rm <filename>

Commit and Sync

Commit Changes

git commit -m "Comment update"

Push Changes to Remote Repo

git push origin master

Connect local repo to Remote repo

git remote add origin <server>

Update local repo with remote changes

git pull

Branches

Create New Branch

git checkout -b <branch>

Switch to Master Branch

git checkout master

Delete Branch

git branch -d <branch>

Push Branch to remote repo

git push origin <branch>