Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+5 votes
2 views
in DevOps and Agile by (19.4k points)
edited by

I'm new at the branching complexities of Git. I always work on a single branch and commit changes and then periodically push to my remote origin.

Somewhere recently, I did a reset of some files to get them out of commit staging and later did a rebase -i to get rid of a couple of recent local commits. Now I'm in a state I don't quite understand.

In my working area, git log shows exactly what I'd expect-- I'm on the right train with the commits I didn't want gone, and new ones there, etc.

But I just pushed to the remote repository, and what's there is different-- a couple of the commits I'd killed in the rebase got pushed, and the new ones committed locally aren't there.

I think "master/origin" is detached from HEAD, but I'm not 100% clear on what that means, how to visualize it with the command line tools, and how to fix it.

1 Answer

+6 votes
by (27.5k points)
edited by

The following command works:

git checkout master

In case there are some changes that you want to keep, you can do this:

git checkout -b temp

git checkout -B master temp

For more information about installation of git and common git commands please go through the following link:

 

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...