Linked Questions
186 questions linked to/from Why did my Git repo enter a detached HEAD state?
41
votes
1
answer
54k
views
Understanding detached HEAD in git [duplicate]
I am learning git and am following the excellent tutorials at http://gitimmersion.com.
In those tutorials, there is a blurb that tries to explain detached HEADs, and that states:
A “detached HEAD” ...
2
votes
1
answer
422
views
Can i commit to the origin/master branch locally? [duplicate]
i did this
git checkout origin/master
# made some changes
git commit -a -m "test something"
After this i did a git checkout master. Then i got this message
Warning: you are leaving 1 commit behind, ...
0
votes
1
answer
122
views
downloaded a repo instead of cloning it from gitlab and fixed bugs,now want to push [duplicate]
Being new to git and gitlab, instead of cloning the repository i downloaded it,fixed bugs in it over 100+ files have changed, now i want to push it to gitlab.
I have tried
-Cloning the repository......
1
vote
0
answers
46
views
Can't switch from detached HEAD when trying a hard reset? [duplicate]
I made a test structure like so:
A - B - C
I checked out commit A, so I was in detached HEAD. But then I thought, "shouldn't a hard reset to the previous head do the same as checking out master?" So ...
0
votes
0
answers
44
views
What if I have a "disconnected commit" in Git? [duplicate]
I don't even know how I got there. I just did a
git commit -am "Some kind of comment"
and git says:
fatal: You are not currently on a branch.
To push the history leading to the current (...
0
votes
0
answers
35
views
I was in the master branch, but after checking out a previous commit, I find I'm in a detached commit, not in the master branch. What is the case? [duplicate]
This happens often in my work recently. For example, I was in the master branch, and I want to go back to a specific commit that I see from the 'git log' command. After I check out that previsou ...
13860
votes
37
answers
3.5m
views
What is the difference between 'git pull' and 'git fetch'?
What are the differences between git pull and git fetch?
2134
votes
29
answers
2.6m
views
How do I fix a Git detached head?
I was doing some work in my repository and noticed a file had local changes. I didn't want them anymore so I deleted the file, thinking I can just checkout a fresh copy. I wanted to do the Git ...
1754
votes
29
answers
1.3m
views
How can I reconcile detached HEAD with master/origin?
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 ...
1515
votes
12
answers
412k
views
How do you rename a Git tag?
Today I was looking through the logs for a project and realized that I fat fingered a tag name some time ago. Is there some way to rename the tag? Google hasn't turned up anything useful.
I realize I ...
1144
votes
15
answers
1.1m
views
How can I specify a branch/tag when adding a Git submodule?
How does git submodule add -b work?
After adding a submodule with a specific branch, a new cloned repository (after git submodule update --init) will be at a specific commit, not the branch itself (...
1110
votes
11
answers
984k
views
How to permanently remove few commits from remote branch
I know that's rewriting of history which is bad yada yada.
But how to permanently remove few commits from remote branch?
427
votes
33
answers
1.3m
views
fatal: The current branch master has no upstream branch
I'm trying to push one of my projects to github, and I keep getting this error:
peeplesoft@jane3:~/846156 (master) $ git push
fatal: The current branch master has no upstream branch.
To push the ...
352
votes
32
answers
481k
views
git push says "everything up-to-date" even though I have local changes
I have a remote gitosis server and a local git repository, and each time I make a big change in my code, I'll push the changes to that server too.
But today I find that even though I have some local ...
661
votes
5
answers
216k
views
What's the difference between HEAD, working tree and index, in Git?
Can someone tell me the difference between HEAD, working tree and index, in Git?
From what I understand, they are all names for different branches. Is my assumption correct?
I found this:
A single ...