NewUserSO
NewUserSO

Reputation: 211

foo file in one Git branch and bar file in another

Can I have two different files in two branches with Git ?

I mean branch master have a file named foo and branch new-master a file named bar.

Upvotes: 0

Views: 49

Answers (1)

Mureinik
Mureinik

Reputation: 311163

short answer - yes.

  1. create the new-master branch from the old master:

    git branch new-master

  2. in master, create foo:

    touch foo git add foo git commit -m "added foo"

  3. switch over to new-master:

    git checkout new-master

  4. create bar:

    touch bar git add bar git commit -m "added bar"

Upvotes: 2

Related Questions