repo和Git 使用记录
2017-02-14 12:04
579 查看
本地:
###步骤: 1、创建文件夹 HelloWorld,进入目录 2、新项目初始化:git init 3、将当前目录下所有文件添加到缓冲区:git add . 4、将缓冲区代码提交到本地仓库: git commit . -m '注释'
远程:
###步骤: 1、在github上创建一个仓库 2、将远程仓库代码下载到本地: git clone https://github.com/ribachua/ribachua.github.io.git 3、设置添加远程仓库地址: git remote add github 'https://github.com/ribachua/ribachua.github.io.git' 4、初始化 git init 5、添加 git add . 6、提交 git commit -m 'first commit' 7、将本地主分支推到远程(如无远程主分支则创建,用于初始化远程仓库) git push -u origin master
其他
查看当前文件/分支状态1、查看当前文件状态 git status
查看分支:
1 查看本地分支 git branch 2 查看远程分支 git branch -r
创建新分支:
///branchName:分支名称 1 创建本地分支(建立分支后,仍停留在当前分支): git branch branchName 2 创建分支后切换到新分支 git checkout branchName
提交分支:
1、提交到本地的当前分支 git commit . -m '注释' 2、提交到远程分支 git commit . -m '注释' git push origin branchName:branchName 2 如果想把本地的某个分支mybranch提交到远程仓库,并作为远程仓库的master分支 git push origin mybranch:master
删除分支:
1、删除远程分支 git push origin :branchName 2、删除本地分支,强制删除用-D git branch -d branchName
合并分支
1、将分支branchName和当前所在分支合并 git merge branchName
标记tag
1、对当前分支打tag: git tag tagContent 2、然后push到远程即可: git push origin branchName:branchName
repo
查看可切换分支1.cd .repo/manifests 2.git branch -a | cut -d / -f 3
拉取代码
1.repo init 2.repo sync
查看当前的分支
1.repo branches
切换所有库到某个分支
1.repo forall -c git checkout branchName
删除所有库的某个分支
1.repo forall -c git branch -D branchName
……
……
……
待续
相关文章推荐
- Git使用点滴记录: You have no permission to access this repo.
- 使用git和repo下载Android的源代码
- andriod git repo 使用方法
- Android: Git/Gerrit/Repo 的使用 <一>
- Git使用笔记(四)Using Repo and Git
- 使用repo和git下载android源码 和 相关解释
- gitweb使用记录[原]
- git使用记录
- git/repo 使用
- 无法访问android.git.kernel.org的情况下如何使用repo
- git repo使用心得
- GIT和repo使用方法:下载内核 android源码包
- GIT和repo使用方法,下载android-2.6.29内核
- GIT 和 repo 使用方法 下载 android-2.6.29 内核
- Eclipse上GIT插件EGIT使用手册之五_查看历史记录
- 使用git和repo管理自己的android代码
- 记录git 的一些使用方法
- GIT和repo使用方法
- Android: Git/Gerrit/Repo 的使用 <二>
- 天天记录 - Eclipse Git插件Egit简单使用