git 使用

git init

1
git init

建立新分支 backup

1
git checkout -b backup

see branch

1
2
3
4
5
6
# see local branch
git branch
# see remote branch
git branch -r
# see local nad remote branch
git branch -a

checkout to branch

1
git checkout backup

add all file

1
git add .

加入全部異動檔案

不論檔案狀態是 Untracked files 或是 Changes not staged for commit(紅色),都會一口氣變成 Changes to be committed(綠色)

1
2
git add -A
git add --all

and commit

1
git commit -m "1st commit"

dump commit 紀錄

1
git log

list commit

1
2
3
4
# list remote commit
git rev-list --remotes
# list all commit
git rev-list –all

add origin

1
git remote add origin https://github.com/hot5656/blog.git

push origin to remote

1
git push -u origin backup

dump remote server setting

1
git remote -v

change origin setting

1
git remote set-url origin https://github.com/hot5656/blog.git

change modify status

1
git status