Question:
I have the following situation: I created a branch, for which I made several commits, pushed to github, now I wanted to merge these commits, which are already in github into one, so they don't become "junk" commits. Does anyone know how it works?
Answer:
You need to do the following:
[1] git checkout -b nomedanovabranch
[2] git checkout nomedasuabranch
[1] That way you'll create a new branch and already switch to it.
[2] That way you will switch to an existing branch
To merge the commits you will need to 'merge' the branches, just do the following:
git pull origin NomedaBranchQueVoceQuerPegarosCommits
Okay, this way (pulling), git will auto-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
Hope this helps! 🙂