Until a few weeks ago I had never used git before in my life, or any version of source control for that matter. I started an internship and am now using it a great deal. I want to begin using it on my own, but there are a few things I am not sure about because where I'm interning already had everything set up. What I want to be able to do is setup a git repository on dropbox for a project that me and another are doing. My questions are below the code, code based off of this post
~/project $ git init
~/project $ git add .
~/project $ git commit -m "first commit"
~/project $ cd ~/Dropbox/git
~/Dropbox/git $ mkdir pro开发者_Python百科ject.git
~/Dropbox/git $ cd project.git
~/Dropbox/git $ git init --bare
~/Dropbox/git $ cd ~/project
~/project $ git remote add origin ~/Dropbox/git/project.git
~/project $ git push origin master
Q1. Is ~/project just going to be our eclipse android project folder?
Q2. How do we go about creating branches? Add a branch for each class we make then checkout that branch and use git add className.java?
Then commit, merge with master, and push to orgin?
Q3. How do we clone from dropbox?
Sorry that some of these are very noobish. I'm just a rookie to the whole idea of source control!
Trust me, Git over Dropbox is a hell! Why don't just upload the git repository to a server? Github if it's not a private project, or Unfuddle otherwise. Answering Q1 and Q3 will make me sad because I know you will be doing it the wrong way XD
On the other hand, with regards to the Q2, if you are not a Git expert (neither your coworker), then don't care about branches (other than the master one). And yes, each time you create a class use git add
, then git commit
then git push
... or:
git commit -am 'The message of the commit'
git push
When you are working with someone else in just one branch, then you should do this each time before starting to work: git pull
. It will basically download and try to merge changes done by your coworker into your local source tree.
Also, if you are going to push something that could cause conflicts with your friend's modification... then Git will tell you about it and you must merge the changes (manually if it's a complex diff).
精彩评论