Git命令(1)

windows中文乱码: http://www.cnblogs.com/Gukw/archive/2012/01/16/2323417.html

 学习地址 :gitflow : http://www.crom.cn/topics/338

http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/001373962845513aefd77a99f4145f0a2c7a7ca057e7570000

                http://git-scm.com/book/zh/v1/Git-%E5%9F%BA%E7%A1%80-%E8%AE%B0%E5%BD%95%E6%AF%8F%E6%AC%A1%E6%9B%B4%E6%96%B0%E5%88%B0%E4%BB%93%E5%BA%93

     http://www.yiibai.com/git/git_different_platforms.html

开发流程: http://www.360doc.com/content/14/0508/17/14416931_375851686.shtml

保存用户名密码: git config --global credential.helper store

 

1. git clone git@github.com:qishuai7/zeus.git

    下载远程代码

2. git brance

    不带参数:列出本地已经存在的分支,并且在当前分支的前面加“*”号标记,

3. git status

    查看当前状态

4. git diff

    查看修改文件

5. git checkout debug_special

     切换分支

6.  git log

     日志

7. git add

git add dir1 ( 添加dir1这个目录,目录下的所有文件都被加入 ) 
Git add f1 f2 ( 添加f1,f2文件)
git add . ( 添加当前目录下的所有文件和子目录 )

8. git commit -m "project source code..."

    提交

9.  git push origin master

    同步

10. git 忽略特殊文件

     在Git工作区的根目录下创建一个特殊的.gitignore文件,然后把要忽略的文件名填进去,Git就会自动忽略这些文件。

11. git remote -v

     查看远程仓库地址 

20.  阿里巴巴提示

Command line instructions

Git global setup
git config --global user.name "三拳"
git config --global user.email "shuai.qi@alibaba-inc.com"
Create a new repository
mkdir login-demo
cd login-demo
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin git@gitlab.alibaba-inc.com:shuai.qi/login-demo.git
git push -u origin master
Push an existing Git repository
cd existing_git_repo
git remote add origin git@gitlab.alibaba-inc.com:shuai.qi/login-demo.git
git push -u origin master

 

免费框架地址:

   git clone https://github.com/yangfuhai/afinal

 

二、git使用ssh密钥

     大概需要三个步骤:
     一、本地生成密钥对;

       执行命令:  

             ssh-keygen -t rsa -C "qishuai@rrkd.cn"  
     二、设置github上的公钥;

             cat ~/.ssh/id_rsa.pub   

               添加到github或gitlab上(注意换行问题)。

     三、修改git的remote url为git协议。

 三、 版本回滚

      http://yijiebuyi.com/blog/8f985d539566d0bf3b804df6be4e0c90.html

四、 其他

  git fetch  更新所有分支

  git checkout -b feature/weixinrun origin/feature/weixinrun  切换到其他分支

五、git 存储 

git stash  save 'save feature 123' // 暂时保存分支修改,这样可以切换到其他分支

git stash list    // 查看所有存储

 git stash pop // 恢复分支修改内容,删除堆栈中第一个

git stash pop stash@{1}  // 恢复第n个

git stash apply  ''         // 恢复第n个,但不删除存储

git stash clear  // 清空所有缓存

git stash drop stash@{0} // 清空第n个缓存

git stash show -p  // 对比查看修改内容

六、tag

git tag  //查看tag
git tag test_tag c809ddbf83939a89659e51dc2a5fe183af384233    //在某个commit 上打tag
git tag
...
git push origin test_tag    //!!!本地tag推送到线上
...
git tag -d test_tag        //本地删除tag
git push origin :refs/tags/test_tag    //本地tag删除了,再执行该句,删除线上tag

 

posted on 2015-04-13 10:22  齊帥  阅读(375)  评论(0编辑  收藏  举报

导航