Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (29.3k points)

Using git I made something like this

git clone

git checkout {a rev number tree rev before} (here I started to be in a detached head state)


git commit


git commit

(some commit where made on origin/master)

git pull (which does complete because there was some error due to the fact that I'm no more on master)

Because it said to me that I can still commit when in a detached head state, I did so. But now I want to like merge my detached head branch and my local master branch, and then push my bunch of changes to origin/master.

So my question is how could I merge the master branch with my actual state (detached head.

1 Answer

0 votes
by (50.2k points)

If you’ve made some commits in the detached head then if you need those commits on your master. For that, all you need is to create a new branch and merge it to master and then delete the branch. For that you can do:

git branch temp

Now checkout to master

git checkout master

Merge the branch

git merge temp 

This will update your master with the commit files or commits.

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

30.5k questions

32.5k answers


108k users

Browse Categories