Answer the question
In order to leave comments, you need to log in
Git push question?
From the git book
$ git checkout -b sf origin/serverfix
Branch sf set up to track remote branch refs/remotes/origin/serverfix.
Switched to a new branch "sf"
Your local sf branch will now automatically push and pull changes from origin/serverfix.
uhm, if I make a branch from master
$ git checkout -b sf origin/master
I commit my changes and do
$ git push
then I will upload all this to the master branch on the server ? and grind all the other changes there?
Answer the question
In order to leave comments, you need to log in
uhm, if I make a branch from master
$ git checkout -b sf origin/master
I commit my changes and do
$ git push
then I will upload all this to the master branch on the server ? and grind all the other changes there?
Short answer: no
Long answer:
> git checkout -b sf origin/serverfix
will branch from the serverfix branch on the remote host
> git push
will not send anything, because nothing has been changed on the sf branch
> git push origin master
will push all changes to master if they were made on top of the last commit, or throw an error if sf does not include all of master's commits
> git push --force origin master
will push all changes to master even if there were commits that are not in sf
In order not to overwrite anything in the master before git push, it is better to do
> git fetch origin
> git rebase origin/master
To look at the commit tree, you can use the command:
> git tree = log --oneline --decorate --all --graph
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question