Chinaunix首页 | 论坛 | 博客
  • 博客访问: 104298
  • 博文数量: 22
  • 博客积分: 45
  • 博客等级: 民兵
  • 技术积分: 225
  • 用 户 组: 普通用户
  • 注册时间: 2012-05-27 17:53
文章分类
文章存档

2017年(1)

2016年(8)

2015年(11)

2014年(1)

2013年(1)

我的朋友

分类: LINUX

2015-12-23 12:29:40

linux下每次pull和push等提交代码都需要输入帐号密码,很麻烦,可以设置帐号密码不用每次都登录,如下:
   1、在~/目录下,用vim打开此文件,

         vim .git-credentials
         #输入内容格式
        
   2,仍然在~/目录下,输入命令
         git config --global credential.helper store
   3、可以看到~/.gitconfig文件,会多了一项:
         [credential]
         helper = store
即可完成以上功能。

git分支查看git branch -a
git下载分支并且分支切换:git checkout 分支名字
创建分支:git branch nm_branch
转到分支上:
git checkout nm_branch

用gitolite新建项目,clone后首次push,可能会出现:
    $ git push  
    No refs in common and none specified; doing nothing.  
    Perhaps you should specify a branch such as 'master'.  
    fatal: The remote end hung up unexpectedly  
    error: failed to push some refs to 'file:///xxxxxxx.git'  
.这是Git 找不到你要提交的版本了。
解决办法:git push origin master


查看本地的所有修改日志动作
git reflog
回退到某个本地版本
git reset 1873864
强制回退到某个版本
git reset --hard 1873864
rebase本地commit
git rebase -i
阅读(1236) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~