Chinaunix首页 | 论坛 | 博客
  • 博客访问: 190512
  • 博文数量: 47
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 470
  • 用 户 组: 普通用户
  • 注册时间: 2014-06-18 12:09
个人简介

be a happy lazy and fat cat

文章分类
文章存档

2017年(1)

2016年(5)

2015年(22)

2014年(19)

我的朋友

分类: Android平台

2015-02-05 16:55:30

提交修改代码
repo start branchname ./all
git add .
git commit -a -s
repo upload .

修改前一次提交保持change-id不变
git add .
git commit --amend

生成patch
git add .
git commit -a -s
git format-patch -s -1

apply patch

git am --3way --ignore-space-change --whitespace=nowarn
放弃git commit 的操作
git reset --hard HEAD(也可以使用commit id)

git add某个文件后不想git commit

git rm 某个文件 这个这个文件就不在git的管理了

git 在提交之前撤销add操作 
   问题:
 
   在使用git时,在未添加.ignore文件前使用 git add . 将所有文件添加到库中,不小心将一些不需要加入版本库的文件加到了版本库中。由于此时还没有提交所以不存在HEAD版本,不能使用 git reset HEAD命令。 
   解决: 
   使用 git rm -r --cached . 
   ps:注意最后是有点的。 
   ---------------------------------------改写最后一次提交--------------------------------------- 
   git commit -m'改写最后一次提交' 
   git add forgotten_file //补上忘记提交的文件 
   git commit --amend 
   ----------------------------------------remote-------------------------------------------- 
   git remote add [shortname] [url] //添加远程仓库 
   git remote -v //列出远程仓库 
   git remote show [remote-name] //列出远程仓库详细信息 
   git remote rename old-name new-name //远程仓库重命名 
   git remote rm [remote-name] //删除远程仓库 
   ----------------------------------------fetch-----------------------------------------------
   git fetch [remote-name] //将远端的数据拉到本地仓库,并不自动合并到当前分支,仍需手工合并。 
   ---------------------------------------tag------------------------------------------------------- 
   git tag v1 //建立标签 
   git tag -a v1 -m '建立标签' 
   git show v1 //查看标签版本信息 
   ---------------------------------- 下自动补全功能------------------------------------ 
   在git源码中 contrib/completion 目录中的 git -completion.bash 复制到自己的用户目录中。并把下面内容添加到你的 .bashrc文件中 
   source ~/.git-completion.bash 
   ---------------------------------设置Git命令别名--------------------------------------------- 
   git config --global alias.co checkout //设置checkout 命令别名 
   git config --global alias.br branch //设置branch 命令别名 
   git config --global alias.ci commit //设置commit 命令别名 
   git config --global alias.st status //设置status 命令别名 
   git config --global alias.last 'log -1 HEAD' //查看最后一次提交信息 
   git config --global alias.visual "!gitk" //启动gitk。运行外部命令,只需在命令前加上 ! 。

push code(faster and showing progress)
echo "SYNC-START"; rm -f /tmp/myfifo;mkfifo /tmp/myfifo; p=$(repo list|wc -l); (echo $((p-1))>/tmp/myfifo &); repo forall -c 'while [ `ps -Cgit -oargs=|grep -c "git push"` -gt 4 ]; do echo "*queue full*";sleep 1;done; (git push -f origin HEAD:refs/heads/abt/private/topic/aosp_stable/lmaster &); read p/tmp/myfifo &); else while [ `ps -Cgit -oargs=|grep -c "git push"` -ne 0 ]; do echo "*waiting jobs*"; sleep 1; done; echo "SYNC-DONE"; fi'

(fast)
repo forall -c 'while [ `ps -Cgit -oargs=|grep -c "git push"` -gt 4 ]; do echo "*queue full*";sleep 1;done; git push -f origin HEAD:refs/heads/abt/topic/gmin/l-dev/YOURBRANCHNAME/master &'

阅读(1390) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~