Git remote 同步远程仓库,保持fork出来的项目和原有项目同步
来源:互联网 发布:淘宝店铺可以买卖吗 编辑:程序博客网 时间:2024/05/01 21:32
我们在创建一个Git工程项目时, 至少可以看到一个名为 origin 的远程库, git 默认使用这个名字来标识你本地工程所对应的远程仓库。
一. 添加远程仓库:
一个git工程除了默认的origin 仓库外,还可以为其添加一个新的远程仓库, 可以随意指定一个名字, 运行 git remote add [shortname] [url]
- $ git remote add new_repository_name git://github.com/paulboone/ticgit.git
- $ git remote
- origin
- new_repository_name
1. 首先添加你从github上fork的源仓库到本地的git工程
- $ git remote add source_repository_name [url]
- (1)同步源仓库的信息到本地
- $ git remote update source_repository_name
- (2)将源仓库的信息merge到本地分支:
- $ git checkout branch_name
- $ git rebase source_repository_name/branch_name
3. $ git push 将最新同步的代码和修改,提交到你的origin仓库
4. Github上提出Push Request即可,将你的origin仓库的所有修改提交到source_repository_name仓库
GitHub常用的开发协同流程为:将别人的仓库fork成自己的origin仓库 → git clone origin仓库到本地 → 本地添加fork源仓库 → 工作前先git remote update下fork源保持代码较新 → coding → push回自己 → github上提出Push Request即可
Git 常见命令一览表:
说明/备注命令备注保存更新git add [-i]-i 逐个确认检查更新git status 提交更新git commit [-a] -m "<更新说明>"-a 包含增删-m 说明信息克隆到本地git clone <git地址> 远端抓取git fetch 与本地当前branch合并git merge抓取并合并git pull [<远端别名>] [<远端branch>]相当于 git fetch + git merge推送到远端git push [-f] [<远端别名>] [<远端branch>]-f 强制覆盖设置一个远端别名git remote add <别名> <git地址>
列出远端git remote -v-v 详细信息查看远端信息git remote show <远端别名>
重命名远端git remote rename <远端别名> <新远端别名>删除远端git remote rm <远端别名>
更新branch列表git remote update [<远端别名>] 列出branchgit branch [-r] [-a]-r 远端
-a 全部新建branchgit branch <branch名> 切换branchgit checkout <branch名> 创建本地branch对应远端branchgit checkout -b <本地branch> -t <远端别名>/<远端branch>-b 新建branch;-t 绑定远端branch设置HTTP代理git config --global http.proxy "<HTTP代理>"恢复默认
Linux系统编辑 ~/.gitconfig 文件设置电子邮件git config --global user.email "<电子邮件>"设置用户名git config --global user.name "<用户名>"查看标签(tag)git tag [--list]打包、快照(snapshot)git archive [--prefix=<前缀路径>/] -o <文件名及格式> <branch或标签>--prefix 指定前缀路径;格式可以是 zip, tar
0 0
- Git remote 同步远程仓库,保持fork出来的项目和原有项目同步
- Git remote 同步远程仓库,保持fork出来的项目和原有项目同步
- Git fork出来的Project和源Project保持同步
- git: 保持fork的项目与上游同步
- Git 怎样保证fork出来的project和原project(上游项目)同步更新
- Git 怎样保证fork出来的project和原project(上游项目)同步更新
- Git 怎样保证fork出来的project和原project(上游项目)同步更新
- 【项目管理】【转】Git 怎样保证fork出来的project和原project(上游项目)同步更新
- fork的项目如何与原项目保持同步?
- 创建git项目并同步到远程仓库的最简单步骤和常用操作。
- Github fork其他项目的分支与主干保持同步
- Git上传项目至远程仓库与同步到本地
- git同步本地仓库和远程仓库
- git使用之五——Github上fork项目后与原项目保持同步
- git使用之五——Github上fork项目后与原项目保持同步
- git fork别人的项目之后 同步远程分支的方法
- Github上fork项目后与原项目保持同步
- github fork源仓库后保持同步
- 管道容量的验证
- UCSC genome browser 个人track 安装
- SQL Server中的转义符
- 实验1
- Asp.Net Redis使用
- Git remote 同步远程仓库,保持fork出来的项目和原有项目同步
- java学习总结-1
- jar执行乱码
- Launcher3源码分析(DeviceProfile)
- BAT 批处理脚本 教程
- centos7 LVS 配置
- 自定义控件(倒计时篇)
- GradientDrawable 动态设置背景的使用
- 1.Gorontine和Channel