I'm test-driving a switch to git for our version control system (using SVN now), and having some issues managing a remote repository on Bitbucket. Two team members have the codebase for a project checked out, and we'd like to add the codebase to Bitbucket. We've both created git repos, but are unable to push to the same branch on Bitbucket. The only way to commit is to pull down from the remote repo first, which I'm hesitant to do (overwriting settings files etc.)
We also tried to push to two separate branches, and then merge, but it says the commits are unrelated and can't merge. I'm new to git, so I might be missing something obvious, but are there specific reasons I'm having such a hard time merging identical codebases in BitBucket?
Before starting to apply what I wrote next, please make a backup. I don't know if I understood correctly what you need and something might break. That being said, lets give it a try.
Take the codebase from SVN and create a local git repository:
$ cd /path/to/src $ git init
Start tracking the files:
$ git add
Make your first commit:
$ git commit -am "Initial import from SVN"
Add bitbucket as remote:
$ git remote add origin ssh://email@example.com/<username>/<repo>.git
And finally push everything:
$ git push -u origin --all
Then your second team member can pull existing codebase, make his changes in a separate branch, merge them back in the development branch and in the end push them to remote and send pull request if necessary. To make thing easier, you can use [gitflow](https://github.com/nvie/gitflow).
What I explained above regarding your colleague, can be done using gitflow like this:
# clone existing repo $ git clone ssh://firstname.lastname@example.org/<username>/<repo>.git # enable gitflow $ git flow init # start a new branch called "start my_super_feature" $ git flow feature start my_super_feature # make code changes, commit them, write awesome code # when you are done, merge the branch where you worked in the development branch $ git flow feature finish my_super_feature
At this point your colleague will have in the development branch your changes (from cloning) and his changes on top of yours. Now he can push the changes back to origin.
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs