SwimBikeRun
SwimBikeRun

Reputation: 4460

Git and bitbucket: How to make a branch

I am just starting with Git as a heads up:

I have successfully done the basics with a master (clone, make changes, commit changes).

Now I want to do the same operations but with a local development branch to experiment with so I don't mess up the master code that is working.

Do I have to use the web GUI to create a new branch? On my computer, I typed the following:

git branch devel
git checkout devel
*modify file a*
git add a
git commit -m "changed a"
git push

Now it appears that it has worked! I can switch between devel and master and see the differences are kept. However, nothing is updated on bitbucket, and there is not even a devel branch listed. What am I missing?

Upvotes: 1

Views: 399

Answers (1)

Sam
Sam

Reputation: 20486

Your remote (BitBucket) doesn't know anything about your new branches until you tell it. You'll have to sync them up the first time by explicitly pushing your new branch:

git push <remote> <branch>
git push origin devel

After this BitBucket will know about the devel branch, and it will show up on fetches, pushes, etc without having to specify it.

More reading here.

Upvotes: 3

Related Questions