I was initially in master branch, then I create a development branch and use that branch by:
git branch development
git checkout development
After that, I start to make changes in my project on development branch.
Then, I commit and push :
git push origin development , so, I created a remote development branch.
Finally, I go back to master branch:
git checkout master ( without merge the changes made on development branch)
Then:
git pull origin master (to get the other developers’ changes on master branch)
BUT, surprisingly, all the changes on development branch are applied to master branch!! WHY?? I did not run command git merge development after I went back to master branch, why the changes applied to my master branch??
As it has already happens, how can I revert back my master branch to be without the changes from development branch now?
Yes, it is the reason, and your
git pull origin masterwill:origin/master(which already contain the merge withorigin/development)Considering that
origin/masterhas already been cloned around, I wouldn’t advise changing its history at this point. So no ‘git reset‘.Should you need to go on working from a master before the merge, simply get the right SHA1 from
git logand:You would start a new branch from you last
master HEADbefore the merge.