版本控制学习笔记

来源:互联网 发布:linux root 密码 暴力 编辑:程序博客网 时间:2024/06/05 03:09
apt-get install git安装看版本git --version(远程仓库)remote repository   (本地仓库)local repository     (git add 就在这)staging area   working directorygit init 本地创建仓库(repository); .git(隐藏文件)(远程建仓库仓库)git clone git://github.com/hello-world.gitgit remote -v 查看远程仓库的地址git push(提交)git format-patch origin/master(打补丁)全局(在.git/config可以看见)(总仓库)git config --global -user.name "名字"git config --global -user.email "邮箱"局部(在.git/config可以看见)(每个仓库)git config  -user.name "名字"git config  -user.email "邮箱"git config --list(查看上面的)分支git branch查看分支git branch xxx 建立分支git checkout xxx 切换分支合并分支git checkout master git merge "mmm" HEAD xxx版本git tag  -a v1 (版本1)git tag  -a v2 -m "va2"(版本2)命令:git add  main.c(文件名)working directory =》staging area命令:git commit -m "1 commit"(提交)staging area=>repository 一步到位命令git commit -a=上面两个命令git status 查看状态(哪些没提交,哪些被删了)git diff :比较 workspace 和staging git diif --cached :比较staged和local repository git checkout -f HEAD(在仓库拿回文件)git checkout -- main.cgit hash-object main.c(计算文件hash值可以省空间)(添加当前目录所有文件)git add . (在.git/objects目录可以看见文件hash值的头两个字节)find .git/objects/ -type f(列出所有文件)git show (文件头2.5字节)可以看见文件内容

原创粉丝点击