If you want to pull over just a single commit from one branch onto another, you can do that with git cherry-pick [HASH-TO-MOVE]
We'll demonstrate that by making a commit on a feature branch, and then copying that commit (but not the entire branch) onto master.
Instructor: [00:00] If we do git branch, we see we have two different branches here. If we do git log one line, we can see that our latest branch has adsHelloWorld as the commit, and that is diverse from master, which is the reversion of the take three commit.
[00:17] This is our app.js on the JSChanges branch. Let's check out master. Now our app.js is empty. Let's say we're on master and we really want that function on master, but we don't want to pull over the entire JSChanges branch yet. What we really want is just to pick this commit and move it over to master.
[00:38] If we do a git log one line now, we see that the latest is revert take three, and we want this adsHelloWorld. We're going to get the hash of the commit that we want, and we're going to do git cherry-pick, and then we're going to do the hash that we want.
[00:56] If we do a git log one line, we can see that our head is pointing at adsHelloWorld, but the hash is different. It's made a new commit hash as it came over and we have our function here.
[01:11] If we are happy with what we have now, we can do a git push. Now, we've copied the commit from js.changes over the master and pushed it up. The commit now exists in both trees.