The code from my branch, did not merge back into the master branch, why not?

Viewed 253

I've been working on a website for a client. I'm using Git on Azure DevOps Services. I am working alone on this and although I've done a lot of self-training on git, I'm still a novice. And since I'm working alone, I've not had any chance to practice branching and merging with git. In order to start working on changes that my client wanted done, I branched. Here's a picture of the Commits from my Azure DevOps Repos section for this project:

enter image description here

At commit 5d2abb2d I started making the changes needed. Then at commit 10e7b46c I merged the changes in the feature branch, back into the master branch.

Or at least I thought that's what I did. I issued a git checkout feature branch, did a pull operation, just to make sure I had the latest locally. I saw all the code I put in at 5d2abb2d. But when I did a git checkout master and did another pull, it looked exactly like it did before I branched to the feature branch!

I'm sure I'm doing something wrong. Probably got the wrong idea, but I don't know what I've done wrong nor how to fix it. I'm glad I didn't delete that feature branch! I'm assuming I can, somehow, still get the changes I've made in the feature branch, back into the master branch. How do I do that, please?

1 Answers

The usual set of command to "merge back to master" should be:

git switch master
git merge feature
git push

(Note: use git switch rather than checkout, with Git 2.23+) At which point, you should see your feature code in master.
A git log --decorate --oneline --graph --all --branches should show you HEAD at master, with two parents (one commit from master, one from feature)

If it is not the case, the merge itself might have not followed that exact sequence of commands.

Related