vincent vincent - 3 months ago 22
Git Question

git can't commit to github

$ 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?

Answer

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
Comments