1.svn与git:分布式和集中式
2.初始化或者创建一个仓库,进入到一个文件夹后,git init
3.加入到仓库缓冲 和提交
4.用git status查看修改的状态,查看后知道哪个文件修改了,用git diff Hello.md 查看不同,红色-something change是之前的,绿色+something change ;;;;;;;;;是之后的
5. 查看一个项目的修改记录,在项目文件夹里git  log,会显示每次修改的-m信息。想看精简的没时间的git log --pretty=oneline。或者git reflog
6.git diff应该用在git add之前。因为git add后就加到了缓冲区,文件已经覆盖。
7.返回节点,git reset --hard head^  就是返回上一个节点
   git reset --hard commit_id 返回到这个id的节点(这个靠谱)
8.移动之后git log不会记录移动的步骤,但是git reflog会记录,可以看到!!
9.一个文件  如果还没有git add 可以用 ,返回上一个节点,用了add了就没用了!!!注意!
10.据说add以后回到上一个节点可以用 git reset  head Hello.md后再用get checkout -- Hello.md可以(没用操作成功!!)      add后可以用git reset --hard 所有文件返回上一个节点 慎用啊  恢复不了
第二种做法(自己摸索的):add之后用git reset 。可以取消add的左右文件,此时在git checkout -- Hello.md就可以了
11.总结起来就是你可以通过commit id回到任何的时间节点!!!
12.一个在本地仓库的文件被rm tao.txt 删除了,那么找回这个文件时 git checkout  -- tao.txt
13.如果没有commit  那没办法,找不回来了,呜呜~~~记得即使commit啊
14.如果删除了或者出现问题了,直接回到上一版版本  git reset --hard commit——id
  注意:回到上一个版本会清除快照或者说stage的内容,即你此时add 的内容,所以add后一定要commit
15.提交顺序:work->index->Head
16.Bitbucket这个是可以私有的,但是只能五个人一起开发
17.确定自己是否已经安装了SSH可以远程git、通信。用ssh -T  git@github.com
18.生成一个sshkey---ssh-keygen -C  “7453324325@qq.com”  linux会在个人主目录下面.ssh文件夹,找到in_rsa_pub 就是,写到网站上,就ok了,再次输入 ssh -T  git@github.com  显示:Hi publci-vic! You've successfully authenticated, but GitHub does not provide shell access.  成功鸟
==========================================================================
网页操作
19.在新建项目的时候,会选择哪个种类的文件,建好后会有 .gitignore文件,里面记录了上传项目的时候会忽略什么文件,以后上传不上来这里修改!!!
20.和远程服务器建立快速连接 用git push就可以方法:
       1.本地仓库写好之后与服务器仓库建立连接,git remote add origin git@github.com:publci-vic/test.git。
       此时已经和远程服务器的这个仓库建立了一个连接
      2.git -u origin master
                     a.此时出现了一个错误To git@github.com:publci-vic/test.git
                         ! [rejected]        master -> master (fetch first)
                         error: failed to push some refs to 'git@github.com:publci-vic/test.git'
                         hint: Updates were rejected because the remote contains work that you do
                         hint: not have locally. This is usually caused by another repository pushing
                         hint: to the same ref. You may want to first integrate the remote changes
                         hint: (e.g., 'git pull ...') before pushing again.
                         hint: See the 'Note about fast-forwards' in 'git push --help' for details.
                    b.原因是和远程版本库文件不一致,处理方法是 git pull git@github.com:publci-vic/test.git,手动或者自动合并不一样的文件。
                    c.然后git -u origin master 成功!
        3.可以快乐的啪啪了,不对,可以快乐的用git push就ok,可以同步代码!
=============================================63:32分钟



















Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐