我就不信了git这个东西 还能难到我。

来源:互联网 发布:linux怎么安装软件.tgz 编辑:程序博客网 时间:2024/06/02 16:54
git-init 初始化一个repository
git-add . "." 表示全部
刚刚新建立的只有master一个branch 并且在没有commit之前不能建立新的branch
git-branch branchname 新建立一个branchname
git-branch 显示现有branch
git-branch -d branchname 删除branchname 但是分之内容的改动还是保留的,-D 就完全删除一个分支了
git-checkout branchname 转到这个branchname
git-merge branchname 把branchname 的分支和当前的分支合并。
git-diff 显示不同(commit之前)git-log查看当前的记录 git-status查看当前的状态
在使用git-commit -a 的时候加入comment的时候 第一行加入不多余50字的summary 然后空一行,然后写详细的内容
gitk 是一个好用的图形化工具。
git pull /home/bob/myrepo master 
This merges the changes from Bob's "master" branch into Alice's current This merges the changes from Bob's "master" branch into Alice's current
branch. If Alice has made her own changes in the meantime, then she may need to
manually fix any conflicts. (Note that the "master" argument in the above command is actually unnecessary, as it is the default.)
branch
pull = fetch + merge


在决定向服务器push代码的时候向master分枝,要保证本地的master是要上传的代码,这样才可以。我一般都是先把自己的远端的分枝push然后再push远端的master
删除 远程分支  git-push origin : branchname
要用本地分支向远程分支push 不能跨分枝
删除远程分支以后本地还是留有远程的副本可以使用git-branch -rd branch name 删除
在新clone下来的东西默认是在本地的master分支 ,如果要是想要向远程的非master分支push东西,就是使用全的命令行 :
git-push orgin master:otherbranchname

git checkout -b ebipr --track origin/keyboard

原创粉丝点击