My question is around how branch pushes work exactly; I have come across something that doesn't make logical sense to me and as such would like an explanation as to why I am experiencing this behaviour.
I have two branches:
I am on (checked out)
dashboard. I make some changes on it and (using the terminal) I type the following:
git add file1.R git commit -m "Updated loop." git push origin dashboard
My understanding is that this now pushes the committed changes into my repository under the
However, out of curiosity I also tried this (whilst still checked out on
git add file1.R git commit -m "Updated loop." git push origin master
Despite specifying that I want to push to
master, the committed changes still appear to have been pushed to
dashboard because when I check
master (both via a GUI and
git log -1), I see that the changes haven't been pushed to
master, but rather to
As such, what is the relevance of specifying which branch to push to? The reason I ask is because it appears that the branch that the committed changes are pushed to correspond with whichever branch I currently have checked out / am pushing from.
git push be the same as typing
git push origin master/
git push origin dashboard (depending on which branch I have checked out)?
It would be great to understand precisely what is happening here.