Linked Questions

253 votes
2 answers
121k views

How do I get my 'Detached HEAD' commits back into master [duplicate]

Looks like a few days ago I created a branch called detached HEAD and have been committing to it. My normal process is to commit to master and then push that to origin. But I can't push detached ...
Travis's user avatar
  • 3,186
2 votes
2 answers
2k views

git stuck in detached head - cannot revert to previous file in branch [duplicate]

I committed a change to my script that completely broke it. I tried restoring to a previous commit in git using this command: git checkout 2af6889905af99b78f7401cb17b718ba86240c2a aws_utils.sh But ...
bluethundr's user avatar
  • 1,217
0 votes
1 answer
501 views

How to make detached head the original branch? [duplicate]

I have a branch. My local branch has 5 (m) commits which I have not pushed to remote. The same branch is 7 (n) commit ahead of me. Now what I want to do is remove my 5 (m) unnecessary commits and ...
vanta mula's user avatar
1 vote
1 answer
259 views

Git branching django [duplicate]

I am looking to edit some of the documentation found on the django project. To do this I have forked, and cloned to my local machine a copy of the django repository on github. The issue I am facing ...
coderly's user avatar
  • 41
1657 votes
21 answers
881k views

How can I undo git reset --hard HEAD~1?

Is it possible to undo the changes caused by the following command? If so, how? git reset --hard HEAD~1
Paul Wicks's user avatar
  • 64.8k
1683 votes
19 answers
1.2m views

How can I revert multiple Git commits?

I have a Git repository that looks like this: A <- B <- C <- D <- HEAD I want the head of the branch to point to A, i.e., I want B, C, D, and HEAD to disappear and I want head to be ...
Bill's user avatar
  • 45.5k
851 votes
7 answers
1.1m views

Go to a particular revision

I cloned a Git repository of a certain project. Can I turn the files to the initial state and when I review the files go to revision 2, 3, 4 ... most recent? I'd like to have an overview of how the ...
xralf's user avatar
  • 3,810
483 votes
15 answers
379k views

Why did my Git repo enter a detached HEAD state?

I ended up with a detached head today, the same problem as described in: git push says everything up-to-date even though I have local changes As far as I know I didn't do anything out of the ordinary,...
Adam Bergmark's user avatar
428 votes
7 answers
595k views

Git update submodules recursively

My project struture ProjectA -FrameworkA (submodule) --Twig (submodule of FrameworkA) How I can update submodules recursively? I already tried some git commands (on ProjectA root) git submodule ...
complez's user avatar
  • 8,172
342 votes
6 answers
384k views

Git, How to reset origin/master to a commit?

I reset my local master to a commit by this command: git reset --hard e3f1e37 when I enter $ git status command, terminal says: # On branch master # Your branch is behind 'origin/master' by 7 ...
Hesam's user avatar
  • 53.2k
260 votes
10 answers
289k views

Git: "Not currently on any branch." Is there an easy way to get back on a branch, while keeping the changes?

So I've done some work in the repository and when I'm about to commit I realize that I'm not currently on any branch. This happens a lot when working with submodules and I am able to solve it, but ...
Erik B's user avatar
  • 42k
244 votes
9 answers
388k views

Git clone particular version of remote repository

I cloned a remote git repository about a month ago. The remote repository has undergone many changes and has now become unstable. Now I need another copy of the repository, version identical to the ...
nandu's user avatar
  • 2,633
122 votes
7 answers
41k views

Git restore last detached HEAD

I have a big problem in my project: this is the scenario. I have an xcode project under Git. Today I realized that the last commit broke some tests, so i checked out the previous commit. I used ...
Ignazio's user avatar
  • 4,854
85 votes
6 answers
92k views

Git: How to move back and forth between commits

I have a newbie question about Git: I need to move back and forth in a history of a branch. That means, I need to get all the files to the state they were in in some old revision, and then I need to ...
Ondra Žižka's user avatar
70 votes
8 answers
16k views

Where does a Git branch start and what is its length?

Every now and then I'm asked, on what commit a certain branch on git starts or if a certain commit has been created on a specific branch. The end point of a branch is pretty clear: that's where the ...
Andreas Dolk's user avatar

15 30 50 per page
1
2 3 4 5 6