http://stackoverflow.com/questions/2519933/git-clone-repo-across-local-file-system
http://git-scm.com/book/en/Git-Basics-Working-with-Remotes
Setup remote file repo v1.
You can simply convert your remote repository to bare repository ( There is no working copy in the bare repository - the folder contains only the actual repository data ) . Execute following command in your remote repository folder:
$ git config --bool core.bare true
Then delete all the files except .git in that folder. and then you will be able to perform git push to the remote repository without any errors.Setup remote file repo v2.
$ mkdir myrepo.git
$ cd myrepo.git git init --bare
Ok, from your local branch:
$ git push origin master:masterClone remote file repo
$ git clone file://\\\\192.168.0.51\codeAdding Remote Repositories
To add a new remote Git repository as a shortname you can reference easily, run:
$ git remote add [shortname] [url]Pushing to Your Remotes
When you have your project at a point that you want to share, you have to push it upstream. The command for this is simple: git push [remote-name] [branch-name]. If you want to push your master branch to your origin server (again, cloning generally sets up both of those names for you automatically), then you can run this to push your work back up to the server:
$ git push origin master
This command works only if you cloned from a server to which you have write access and if nobody has pushed in the meantime. If you and someone else clone at the same time and they push upstream and then you push upstream, your push will rightly be rejected. You’ll have to pull down their work first and incorporate it into yours before you’ll be allowed to push.Fetching and Pulling from Your Remotes
As you just saw, to get data from your remote projects, you can run:
$ git fetch [remote-name]
http://git-scm.com/book/en/Git-Basics-Working-with-RemotesThe command goes out to that remote project and pulls down all the data from that remote project that you don’t have yet. After you do this, you should have references to all the branches from that remote, which you can merge in or inspect at any time. (We’ll go over what branches are and how to use them in much more detail in Chapter 3.)
If you clone a repository, the command automatically adds that remote repository under the name origin. So, git fetch origin fetches any new work that has been pushed to that server since you cloned (or last fetched from) it. It’s important to note that the fetch command pulls the data to your local repository — it doesn’t automatically merge it with any of your work or modify what you’re currently working on. You have to merge it manually into your work when you’re ready.
If you have a branch set up to track a remote branch (see the next section and Chapter 3 for more information), you can use the git pull command to automatically fetch and then merge a remote branch into your current branch. This may be an easier or more comfortable workflow for you; and by default, the git clone command automatically sets up your local master branch to track the remote master branch on the server you cloned from (assuming the remote has a master branch). Running git pull generally fetches data from the server you originally cloned from and automatically tries to merge it into the code you’re currently working on.Merging branch (force theirs option)
$ git merge -s recursive -X theirs branchName
Brak komentarzy:
Prześlij komentarz