0
$ git --version   # my git version
git version 2.7.4

$ ls  # three directories
Nim_Game Reverse_String  Sum_of_Two_Integers

$ git status
HEAD detached from origin/master
nothing to commit, working directory clean

$ git log --oneline --decorate --graph --all    # part info of commits
* dad1c24 (HEAD) add Sum_of_Two_Integers
* a7c4e04 (origin/master, origin/HEAD, master) delete
* 50d07fe delete
* 1323f39 delete
* 78a7dda modify file name
* 60f58a5 Nim_Game
* 456dfe3 add Reverse_String.java

I've already commit Sum_of_Two_Integers to local repo, but i can't push it to github. How can i fix this?

vincent
  • 625
  • 1
  • 8
  • 20
  • 1
    The head is detached. You have to check out the origin/master and merge in any changes, then re-commit. Please look at [this answer](http://stackoverflow.com/a/20479669/1960180). – Aaron D Aug 24 '16 at 03:48

1 Answers1

0

You can shift to a new temp branch now and integrate it later in master.

git commit -m "Suitble Message"
git branch new-temp-branch
git checkout master
git merge new-temp-branch
Shravan40
  • 8,922
  • 6
  • 28
  • 48