假设 Alice 启动了一个新项目,其git仓库是在/home/alice/project,并且Bob在同一台机器上有一个主目录,他想要贡献该项目。
Bob 就会执行 $ git clone /home/alice/project myrepo,这会创建一个新目录,里面包含了Alice的仓库的一个克隆版。
Bob修改了一些文件后,提交了改动:
(edit files)
$ git commit -a
然后,Bob告诉Alice从位于/home/bob/myrepo的repository把改动pull过来,Alice这么做:
$ cd /home/alice/project
$ git pull /home/bob/myrepo master
这会把来自bob的master分支的改动合并到Alice的当前分支中去。如果Alice同时做了她自己的改动,她可能要手动修复任何冲突。注意,上面命令中的master参数是不必要的,因为默认就是。
pull 命令一共执行了2个操作:(1)从一个远程分支抽取变化的东西(2)将抽取过来的东西合并到当前分支中去。
$ git remote add bob /home/bob/myrepo 这个命令是定义远程仓库快捷方式,这样的话,Alice刚才做的pull操作中的第一步也就是fetch就可以缩写为:$ git fetch bob,不过这和一开始那个长形式的写法不同,抽取过来的变化的东西会存放在一个远程跟踪分支中,这里就是 bob/master。Alice检查完改动后,就可以将其合并到她的master分支中:$ git merge bob/master。
之后,Bob可以用Alice的最近改动更新自己的仓库,用 $ git pull,注意,Bob不需要给出Alice的仓库的地址,因为当Bob克隆Alice的仓库时,git 会将Alice的仓库的位置保存到仓库配置中用于Bob的pull操作。
Administrator@LQMKPOUFYZVZGKA ~/git/AOS (master)
$ git config --get remote.origin.url
https://git.oschina.net/osworks/AOS.git
git 还保留了Alice的master分支的一个原始拷贝,在 origin/master下:
$ git branch -r
origin/master
如果Bob之后决定从一个不同的主机来工作,他仍然可以执行克隆和pull,用的是ssh协议:
$ git clone alice.org://home/alice/project myrepo
Git还能够以CVS式的模式来使用,它有一个中心仓库,各个用户把改动push到其中去。
1、公共git仓库
向一个项目提交改动的另一种办法就是告诉那个项目的维护者从你的仓库把改动pull过去。如果你和维护者在同一台机器上都有自己的账号,那么你们只要直接从对方的仓库将变动pull过来就行了。
$ git clone /path/to/repository
$ git pull /path/to/other/repository
对于只有少数开发人员的项目而言,或者是对于同步少量的私有仓库而言,这可能就是你所需要的。
然而,更常见的办法是维护一个独立的公共仓库(通常是在一个不同的主机上),让其他人从这台机器上pull变化的内容。这通常更方便。你在你的个人仓库中做每天的工作,但是会阶段性地将你个人仓库中的变化的东西push到公共仓库中去,这样其他开发者就能从公共仓库去取了。
2、将改动push到公共仓库中去
$ git push ssh://yourserver.com/~you/proj.git master:master 或者
$ git push ssh://yourserver.com/~you/proj.git master
..............................................................
相关推荐
or software development usually associated with distributed computing, you’ll focus on particular analyses you can build, the data warehousing techniques that Hadoop provides, and higher order data ...
or software development usually associated with distributed computing, you’ll focus on particular analyses you can build, the data warehousing techniques that Hadoop provides, and higher order data ...
Windows Communication Foundation is the .NET technology that is used to build service-oriented applications, exchange messages in various communication scenarios, and run workflows. This guide enables...
一种领域特定的语言,用于使用自定义分发策略构建水平可伸缩的React式工作流程应用程序。 是在我在博士学位的背景下建立的。tter子Skitter是一种React式工作流程系统; 通过将组件组合到工作流中,可以定义自动响应...
Git is one of the most popular types of Source Code Management (SCM) and Distributed Version Control System (DVCS). Despite the powerful and versatile nature of the tool enveloping strong support for ...
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git is easy to learn and has a tiny ...
In easy-to-follow lessons that take an hour or less, you'll dig into Git's distributed collaboration model, along with core concepts like committing, branching, and merging. This book is a road map ...
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git is easy to learn and has a tiny ...
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git is easy to learn and has a tiny ...
Hadoop Distributed File System Versions 1.0 and 2.0 Hour 4. The MapReduce Job Framework and Job Execution Pipeline Hour 5. MapReduce—Advanced Concepts and YARN Part II: Getting Started with ...
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git is easy to learn and has a tiny ...
This plugin wraps swagger-codegen, and exposes a configurable generateSwagger gradle task that you can plug inside your gradle build/workflows. Getting Started Swagger Gradle Codegen is distributed ...
- **Oozie**: A workflow scheduler for managing Hadoop jobs and complex workflows. The chapter includes detailed instructions on how to set up and use these tools to automate and schedule data ...
This integration can streamline workflows and improve productivity. 3. **Extensibility:** Communication Manager is designed to be extensible, allowing developers to create custom applications and ...
What this book covers Chapter 1, Package Installation and Management, explains how ...Chapter 16, Python Geoprocessing with Hadoop, explains how to perform geospatial analysis using distributed servers.
These operations form the foundation of data processing workflows in PySpark and are essential for any data scientist or engineer working with large datasets. By mastering these techniques, you'll be...