Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I plan to use git for hosting my projects on my server.

I've read about cgit, git-daemon, and I more or less decided to use those tools. But general use is still kind of confusing for me.

What do I need to set up on the server, to push my files onto it. And when the files on the server are newer as the files on my computer, how do I merge them?

Also, I use, say, two computers where I develop. How do I merge from one computer to the other?

Also, when two people are working on the same project, how do they merge their local repos from one another?

As you probably can tell by now, I come from SVN, but I've worked with Mercurial and now I'd like to test git.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

What do I need to set up on the server, to push my files onto it.

Just install git on the server. And mkdir repo_name and cd repo_name then do git init --bare, then push via ssh.

And when the files on the server are newer as the files on my computer, how do I merge them?

git remote add remote_name login@server:/path/to/repo.git

git fetch remote_name

git merge remote_name/branch_name

or do a rebase instead.

Also, when two people are working on the same project, how do they merge their local repos from one another?

First, your colleagues need to clone your repo, or run git remote add in their existing repo. git fetch yourremote will get all your commits to your colleague's local repo, then he run git merge yourremote/branch_nameto merge the change. Then he git push myownremote

Git is hard to learn, progit and git community book are both free and teaches to start using git, setup git server. Github is a great service to use ( the workflow stays the same as you private lan )

share|improve this answer
    
git pull to fetch and merge in one step. –  grawity Mar 19 '11 at 16:17
    
OK, and what if don't have a name for a branch yet? And what about cgit? How do I set that up with a remote repo? –  polemon Mar 19 '11 at 16:28
    
It think you have to name a branch to push it to a server (bare repo), read here: progit.org/book/ch4-2.html –  yaroot Mar 19 '11 at 22:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.