建立一個新倉庫html
➜ h5 mkdir o-knowme ➜ h5 cd o-knowme ➜ o-knowme git init Initialized empty Git repository in /Users/chenliying/Documents/workspace/h5/o-knowme/.git/ ➜ o-knowme git:(master) touch README.md ➜ o-knowme git:(master) ✗ touch meta.json ➜ o-knowme git:(master) ✗ git add . ➜ o-knowme git:(master) ✗ git commit -m'first commit' [master (root-commit) 919ca41] first commit 3 files changed, 6 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 meta.json ➜ o-knowme git:(master) git remote add origin git@gitlab.pengpeng.la:html5/o-knowme.git ➜ o-knowme git:(master) git push -u origin master Counting objects: 4, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (4/4), 313 bytes | 0 bytes/s, done. Total 4 (delta 0), reused 0 (delta 0) To git@gitlab.pengpeng.la:html5/o-knowme.git + [new branch] master -> master Branch master set up to track remote branch master from origin.
查看遠程狀況html5
➜ module git:(master) git remote -v origin git@gitlab.pengpeng.la:html5/module.git (fetch) origin git@gitlab.pengpeng.la:html5/module.git (push)
現有倉庫clonegit
h5 git clone git@gitlab.pengpeng.la:html5/mpt-core.git
查看倉庫狀態json
git status
切換分支gitlab
➜ o-mpt git:(master) git checkout daily/1.0.0 Switched to branch 'daily/1.0.0'
查看所有分支fetch
➜ o-knowme git:(master) git branch -la * master remotes/origin/master
刪除本地分支spa
➜ o-knowme git:(master) git branch -D la Deleted branch la (was 1eb39de).
刪除遠程分支code
$ git push origin --delete daily/1.0.0
查看taghtm
➜ o-mpt git:(master) git tag publish/1.0.0
add 並提交所有文件rem
➜ o-knowme git:(master) ✗ git commit -am'meta.json' [master 1eb39de] meta.json 1 file changed, 14 insertions(+)
將更改數據推送到遠程倉庫
➜ o-knowme git:(master) git push origin master
刪除本地tag
➜ frame git:(master) git tag -d publish/1.0.5
刪除遠程tag
➜ frame git:(master) git push origin --delete tag publish/1.0.5