git是分布式版本控制工具,svn则是集中式的,版本都是放在集中服务器上,开发人员需要自己从中央服务器下载最新版本。
提到集中式和分布式,最容易想到的就是单点故障问题,如果集中服务器出现了故障,那么就不可用了,但是分布式就不会存在这种问题。
修改设置用户名和邮箱,这个设置是保存在本地的git配置文件中
获取git仓库
相关概念
工作目录文件的状态:untracked未被纳入版本控制,unmodified未修改,staged已暂存 git status查看
git add将untracked的加入stage,git reset取消暂存,git commit将暂存的内容提交到本地仓库,git rm删除文件:删除的只是工作区的文件,需要提交到本地仓库
忽略列表 在工作目录中创建gitignore隐藏文件夹,列出要忽略的文件模式
# no .a files
*.a
# but do track lib.a, even though you‘re ignoring .a files above
!lib.a
# only ignore the TODO file in the current directory, not subdir/TODO
/TODO
# ignore all files in the build/ directory
build/
# ignore doc/notes.txt, but not doc/server/arch.txt
doc/*.txt
# ignore all .pdf files in the doc/ directory
doc/**/*.pd
git log查看日志记录
.idea隐藏文件和.iml文件,target文件夹不应该交给git管理
Git报错-refusing to merge unrelated histories 加上--allow-unrelated-histories
存在冲突,但是我想合并两个分支:先修改冲突文件,git add git commit提交合并
解除版本控制,删除git文件夹和vcs配置文件
【Git】如何在Idea中将自己的项目添加到Git上并且推送到远程仓库?
基于一对秘钥,公钥放在需要访问的服务器
原文:https://www.cnblogs.com/ningdeblog/p/git.html