本文共 1822 字,大约阅读时间需要 6 分钟。
$ git clone git://github.com/jquery/jquery.git
$ git remote -v
$ git remote add [name] [url]
$ git remote rm [name]
$ git remote set-url --push [name] [newUrl]
$ git pull [remoteName] [localBranchName]
$ git push [remoteName] [localBranchName]
提示:如果想将本地的某个分支
test
提交到远程仓库,并作为远程仓库的master
分支或另一个名为test
的分支,可以使用以下命令:$ git push origin test:master
或$ git push origin test:test
$ git branch
$ git branch -r
$ git branch [name]
$ git checkout [name]
$ git checkout -b [name]
$ git branch -d [name]
(-D 选项强制删除未合并的分支)$ git merge [name]
$ git push origin [name]
$ git push origin :heads/[name]
或 $ git push origin :[name]
$ git tag
$ git tag [name]
$ git tag -d [name]
$ git tag -r
$ git push origin [name]
$ git push origin :refs/tags/[name]
$ git pull origin --tags
$ git push origin --tags
$ git tag -a [name] -m 'yourMessage'
$ git submodule add [url] [path]
例如:
$ git submodule add git://github.com/soberh/ui-libs.git src/main/webapp/ui-libs
$ git submodule init
$ git submodule update
$ git rm --cached [path]
.gitmodules
文件,删除子模块配置.git/config
文件,删除子模块配置.gitignore
文件,写入需要忽略的文件夹名或文件: target/bin/*.db
.gitignore
文件列表来确认忽略的文件或文件夹: $ git status --ignore-file
git branch
git status
git commit
git commit -m "log_message"
git branch -a
git branch -r
git push
git pull
git push origin serverfix:awesomebranch
git fetch
转载地址:http://nrvwk.baihongyu.com/