原文链接:http://blog.kesixin.xin/article/61 今天查git命令的时候看到这篇文章,总结的很好,转载一发
序号 | 模块 | 功能 |
|---|---|---|
1 | CREATE | 关于创建的 |
2 | LOCAL CHANGES | 关于本地改动方面的 |
3 | COMMIT HISTORY | 关于提交历史的 |
4 | BRANCHES & TAGS | 关于分支和标签类的 |
5 | UPDATE & PUBLISH | 关于更新和发布的 |
6 | MERGE & REBASE | 关于分支合并类的 |
7 | UNDO | 关于撤销类的 |
8 | SUBMODULE | 关于子模块 |
git clone ssh://user@domain.com/repo.gitgit initgit statusgit diff
git diff <fileName>git add -Agit add .git add -ugit add -p <file>git commit -agit commit$ git commit --amendgit loggit log -p <file>git blame <file>git branch -agit branch -avgit checkout <branch>git branch <new-branch> <old-branch>git checkout -b <new-branch>git branch -d <branch>git push origin --delete <branch>git taggit tag <tag-name>git tag -d <tag-name>git push origin tagname
git push origin --tagsgit remote -vgit remote show <remote>git remote add <shortname> <url>git fetch <remote>git pull <remote> <branch>git push <remote> <branch>git branch -dr <remote/branch>git push --tagsgit merge <branch> git rebase <branch>git rebase --abortgit rebase --continuegit mergetoolgit add <resolved-file>git rm <resolved-file>git reset --hard HEADgit reset --hard HEAD^git checkout HEAD <file>git revert <commit>git reset --hard <commit>git reset <commit>git reset --keep <commit>git submodule add https://github.com/xxxxxx/Test// 方法一
git clone https://github.com/xxxxxx/MainProject
cd MainProject // 子模块目录Test没有文件
cd Test
git submodule init
git submodule update // 执行完后就有子模块的代码了
//方法二
// 自动更新子模块中的代码
git clone --recurse-submodules https://github.com/xxxxxx/MainProject// 需使用 `--allow-unrelated-histories`
// 将远程master项目合并到你本地项目
git pull origin master --allow-unrelated-histories