Git Notes

Clone a Repository

  1. git config –global user.name <your-email-address>
  2. git config –global user.email <your-email-address>
  3. Make sure the destination Git Repository folder does not already exist
  4. git clone https://github.com/…/.git

Sync Repository

  1. git status
  2. git add .
  3. git commit -m “<description>”
  4. git push -u origin master

View Remote Branches

  1. git remote -v
  2. git branch -a -vv

Add, name and fetch a Remote Branch

  1. git remote add <friendly-name> https://github.com/…/.git
  2. git fetch <friendly-name>
  3. git remote -v

Checkout a Branch

  1. git checkout -b <friendly-name> <repo-to-checkout>/master
  2. git branch

Cleanup

  1. git remote -v
  2. git remote rm <repo-to-remove>
  3. git branch -d <repo-to-delete>
  4. git branch -a -v
  5. git log –graph

Categories: git

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Git Notes

Clone a Repository

  1. git config –global user.name <your-email-address>
  2. git config –global user.email <your-email-address>
  3. Make sure the destination Git Repository folder does not already exist
  4. git clone https://github.com/…/.git

Sync Repository

  1. git status
  2. git add .
  3. git commit -m “<description>”
  4. git push -u origin master

View Remote Branches

  1. git remote -v
  2. git branch -a -vv

Add, name and fetch a Remote Branch

  1. git remote add <friendly-name> https://github.com/…/.git
  2. git fetch <friendly-name>
  3. git remote -v

Checkout a Branch

  1. git checkout -b <friendly-name> <repo-to-checkout>/master
  2. git branch

Cleanup

  1. git remote -v
  2. git remote rm <repo-to-remove>
  3. git branch -d <repo-to-delete>
  4. git branch -a -v
  5. git log –graph

Categories: git

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s