Daniyaal Khan
Daniyaal Khan

Reputation: 285

Git syncs master changes to all other branches

I have been writing code and wish to create seperate versions of it as branches

i had set up branches like 0.1, 0.2, 0.3, etc on github with the dropdown menu. But when I compare them with master, I notived that 0.1 had no difference from master. which means all the changes pushed to master got pushed into 0.1 also.

How do I stop this from happening.

And for the record, I am extremely new to git and github

Upvotes: 1

Views: 30

Answers (2)

Victor Yarema
Victor Yarema

Reputation: 1325

When you create new branch it doesn't differ from its origin. The changes comes only from different commits in different branches.

BTW: you can edit files in online text editor on github, no need to clone anything for the simplest work.

To modify specific file in specific branch you need to:

  • Switch to the branch where you want to work.
  • Navigate to file and open it.
  • Open onlite text editor for that file.
  • Submit commit form at the bottom of page.

To come up with different files in different branches you'll need just to repeat those steps.

Upvotes: 1

VonC
VonC

Reputation: 1323363

I had set up branches like 0.1, 0.2, 0.3, etc on github with the dropdown menu.
But when I compare them with master, I noticed that 0.1 had no difference from master.

All those branches reference at first the same HEAD than master.

You would need to clone that GitHub repo, switch to (for instance) the 0.1 branch (git checkout -b 0.1), make some commits and push back that branch in order for the "branch comparison" view from GitHub to display some differences between master and 0.1.

Upvotes: 2

Related Questions