git 操作实例(git commit, git push, git branch, git checkout, git reset)
来源:互联网 发布:梦幻2017改版盘丝数据 编辑:程序博客网 时间:2024/05/16 19:14
1. modify and add files to remote server
scp -p -P 29418 wangyonghui@10.2.48.50:hooks/commit-msg .git/hooks/
git status 查看当前目录修改是否争取
git branch -a 查看当前工作的branch
git checkout -b yourbranchname yourbranchname 是为当前工作内容起的临时branch 名字,可以是任意值
进行修改,添加文件
git diff 验证修改文件正确
git status 验证添加文件正确,没有多余的文件或者临时文件
git add . 添加文件到本地库
git commit . -m "CR number , author name, your message for this commit“
git push aosp HEAD:refs/for/android4.4.2_r2 aosp
ok your code commit to remote server for review.
2. update remote server commit
根据第一步的方式完成修改和添加文件,在git push 的时候指定更新。
git push aosp HEAD:refs/changes/82 82 is the number you want to update
3. remove files on remote server
git status 查看当前目录下的文件
git branch -a 查看当前工作的branch
git checkout -b yourtempbranchname
rm files
git rm files
git commit . -m "CR number , author name, your message for this commit“
git push aosp yourtempbranchname:refs/for/android4.4.2_r2
or
git push aosp HEAD:refs/for/android4.4.2_r2
4. 删除临时branch name
git branch -D yourtempbranchname
5. git reset to the version you want
git reset --hard HEAD^
彻底撤销最近的提交。引用回退到前一次,而且工作区和暂存区都会回退到上一次提交的状态。自上一次以来的提交全部丢失。
6. 永久删除最后提交的3个commits
git reset --hard HEAD~3
彻底撤销最近的3次的提交。引用回退到前三次,而且工作区和暂存区都会回退到前三次提交的状态。自前三次以来的提交全部丢失。
7. sync your committed code only
repo sync platform/yourcodepath
e.g. repo sync platform/package/fileexplorer/
- git 操作实例(git commit, git push, git branch, git checkout, git reset)
- git reset &&git checkout
- git 撤销操作--git checkout、git reset、git revert、git commit -- amend
- git commit & git push
- git分支操作(git branch;git checkout;git checkout -b;git merge;git merge --abort)
- git checkout与git reset
- git reset和git checkout
- git checkout 和 git reset
- git reset, git checkout, git revert 区别
- git reset、git checkout、git revert总结
- git reset, git checkout, git revert 区别
- Checkout remote Git branch
- git撤销操作(git checkout; git reset)
- # git branch git checkout new-branch
- git clean reset checkout
- git reset head、checkout
- git checkout reset revert
- git reset checkout
- 【转载】WinSock编程基础
- python学习笔记
- MySql Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' 解决方法
- java
- WCF AJAX在asp.net上的初级实现DEMO
- git 操作实例(git commit, git push, git branch, git checkout, git reset)
- 程序员/开发者的时间都去哪了?
- Lua和C语言的交互(二)
- HDU 1002 A+B problemII
- Lua和C语言的交互(一)
- 【小白笔记】PHP学习之路 (17) --通过回调函数得到数组交集或差集
- HDU-4288 Coder 线段树
- 在PLSQL"Command Windows"中执行导入导出操作(imp、exp命令)
- cocos2d-x笔记(2)