You need to do the following:
[1] git checkout -b nomedanovabranch
[2] git checkout nomedasuabranch
[1] This way you will create a new branch and will already switch to it
[2] This way you will switch to an existing branch
To join the commits you will need to merge the branchs, just do the following:
git pull origin NomedaBranchQueVoceQuerPegarosCommits
Ready, that way (pull), git will automatically merge for you and take the commits from the branch you just pulled.
Then you just go up to your repository
git add . ou git add -A (Vai adicionar todos os arquivos)
git commit -m "Fazendo um merge"
git push
I hope I’ve helped! :)
You want in case do a PR (Pull request) for master?
– guastallaigor
You will need to rebase by choosing to squash commits you no longer want (they will not be deleted but unified with your previous commits).
– Giovanni Nunes
In fact you won’t actually delete commits, just abandon them and create others quite similar to the previous ones.
– Giovanni Nunes
Yes, I’ve tried doing that but I didn’t get it very well I had to use the remote
git rebase -i -root
and when it was to push I had to force, this is not recommended because no?– Cláudio Hilário