Skip to content

Latest commit

 

History

History
115 lines (76 loc) · 2.06 KB

File metadata and controls

115 lines (76 loc) · 2.06 KB

Git


remote server: https://github.com

username: hong-chen

name: Hong Chen

email: me@hongchen.cz


First time setup

  • Mandatory
git config --global user.name "Hong Chen"
git config --global user.email me@hongchen.cz
  • Optional
git config --global core.editor vim
git config credential.helper 'cache --timeout=3600'

Create a repository

  • Clone from existing repository on server
git clone https://github.com/hong-chen/dotfiles.git
  • Initialize local directory and link it to a server repository

First go to the directory you want to initialize,

cd /Users/hchen/mygit/dotfiles

then,

git init

Then go to your git server, e.g., github, and create an emtpy new repository (no .gitignore, no README).

Create a repository named dotfiles under account hong-chen. There will be a link for the repository:

https://github.com/hong-chen/dotfiles.git.

Link your local directory to the newly created repository,

git remote add origin https://github.com/hong-chen/dotfiles.git

Basic commands

  • Before changes are made
git status
git branch

git branch develop-test1
git checkout develop-test1

git checkout -b develop-test2
  • After changes are made
git checkout develop-test2
git add README.md
git commit -m "create README.md"
git pull origin develop-test2
git push -u origin develop-test2

Add a submodule

e.g. reveal.js

git submodule add https://github.com/hakimel/reveal.js.git
git submodule update --init

Merge a branch

For example, you are at the test branch test. After testing, you want to merge the changes made in the test into master branch.

git merge master
git checkout master
git merge --no-ff test