2

sorry, noob here.

I've researched this, but everyone refers to branches and I'm not sure I'm dealing with a branch.

A while ago I messed up the website I'm working on over the process of 4 commits. So I went back four commits, and just kept working from there. Since then I've saved maybe 10 commits, but I never "officially" made a branch, so I'm not sure if I'm on a branch. I'm definitely not on MASTER because I left it a long time ago.

How do I make what I'm working on into the MASTER branch?

added per request:

$ git branch -v 
* (detached from 626a6f1) aea944b trying to make new branch 
  bottom_drop_side_menu 46e7358 quick save 
  lowermenu 4e89d92 So here's a kind of nice lower menu. Client doesn't dig :( 
  master 2071f52 the categories arent working...
msw
  • 42,753
  • 9
  • 87
  • 112
cbolorinos
  • 21
  • 3
  • @cbolorinos Please try running `git branch -v` and show us the output. – halfzebra Jul 16 '15 at 12:38
  • `$ git branch -v *(detached from 626a6f1) aea944b trying to make new branch bottom_drop_side_menu 46e7358 quick save lowermenu 4e89d92 So here's a kind of nice lower menu. Client doesn't dig :( master 2071f52 the categories arent working...` – cbolorinos Jul 16 '15 at 12:39

2 Answers2

2

Simply make a new branch where you are (on the detached HEAD aea944b):

git checkout -b tmp

And replay it on master:

git rebase master

Then merge tmp in master

git checkout master
git merge tmp

See also "Why did my Git repo enter a detached HEAD state?".

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

you are in 'detached head' state. one option would be to stash the changes you have right now and apply them to master.

git stash
git checkout master
git apply

you might have merge conflicts to solve between the state you are on now and the current state of master.

André R.
  • 1,627
  • 10
  • 14
  • Wouldn't you lose the history of commits done in the detached HEAD branch though? – VonC Jul 16 '15 at 12:52
  • good point ... yes, that's true ... the commits would be squashed. but if that is ok it's really quick and simple. – André R. Jul 16 '15 at 13:58