如何使用Git
如何安装Git
如何配置Git
git config --global user.name "yourname"
git config --global user.email "yourname@youremail_server.com"
git config --global core.editor code
-- .
--
如何创建仓库
git init newrepo
git add .
git reset HEAD
git commit -m "初始化项目版本"
git commit -a rem 提交缓存
git commit -am "初始化项目版本"
git status
git diff 尚未缓存
git diff
git diff HEAD rem 已缓存/未缓存
git diff
git clone <repo>
git clone <repo> <directory>
git rm <file>
git rm -f <file>
git rm -cached <file>
git rm -r *
git mv <file-name> <file-new-name>
--
git push -f origin master
如何分支管理
git branch <branch_name>
git checkout <branch_name>
git checkout -b <branch_name>
git merge [branch_name]
git add <conflict_file>
git branch -d <branch_name>
git branch
如何查看提交历史
git log
git log
-- --
-- -- -
--.. ---- ---
标签
git tag -a <tag> <series>
git tag
git log
如何使用远程仓库
ssh-keygen -t rsa -C "yourname@youremail_server.com"
mkdir local_repo
cd local_repo/
echo "# 本地库 Git 测试" >> README.md
ls
git init
git add README.md
git commit -m "添加 README.md 文件"
git remote add [shortname] [url]
git remote add origin remote_repo
git remote rm [alias]
git
git push [alias] [branch]
git push -u origin master
git
git
git fetch [alias] rem 下载新分支
git merge [alias]/[branch]rem 合并分支
git fetch origin
git merge origin/master