1

I'm new to git, I did this:

git clone ssh://user@myserver.com/~/repo/oldsvn/
git checkout -b featurex

modified some files and then

git add file1 file2
git commit -m "Adding feature x"

$ git branch
* featurex

$ git show-ref 
4fe94de84442a1f0c70b434d0facf33148834b7a refs/remotes/origin/oldsvn/release2
96840b05346dd98660951ac6a910bfa053b6828e refs/remotes/origin/oldsvn/release3
315b31c25ae6de0605ed20211939ea930de3d785 refs/remotes/origin/oldsvn/trunk

Now, I want my changes to be in the branches named release2 and release3.

What should I do? My branch is tracking the resources from which remote branch? -release2/file1 is different from release2/file1. I want to know who is the "father" of my branch.

Sorry, for sure someone will think these are easy questions. I have already tried with several commands (like git push origin master) and I all got are errors. Want to start from scratch this time.

ridvankucuk
  • 2,407
  • 1
  • 23
  • 41
JDoe
  • 11
  • 1
  • Possible duplicate of [Push a new local branch to a remote Git repository and track it too](http://stackoverflow.com/questions/2765421/push-a-new-local-branch-to-a-remote-git-repository-and-track-it-too) – jopasserat Mar 18 '16 at 21:20

2 Answers2

0

Before committing anything. Create a feature branch and switch to the feature branch you created

git branch feature2
git checkout feature2

Then commit changes

git add .
git commit -m "changes committing in feature 2"

Then

git push --set-upstream origin stackoverflow

Check on your git repo online, there should be a new branch created with name feature2 and the new commit you did now in that branch. Also git show-ref should show both versions of branch refs/heads/feature2 and refs/remotes/origin/feature2

Milind Gokhale
  • 575
  • 2
  • 14
0

If you don't specified a branch when you clone a remote repository git clone the master branch so it is the father of your local branch named featurex.

If you want that your local changes are also in the branch release2 and release3 you must checkout this two branch and merge this with featurex.

Here a good explanation https://git-scm.com/book/it/v2/Git-Branching-Basic-Branching-and-Merging

conventi
  • 430
  • 3
  • 8