Rollback to a previous Github commit [duplicate]

Multi tool use
Multi tool use












-1















This question already has an answer here:




  • How to revert multiple git commits?

    12 answers



  • Move commit to different branch

    2 answers




Trying to revert to a previous Github commit. I'm now really struggling with committing it to the master. I think I've created a branch but can't get my head around how to move this to master from the documentation available.



git add .    
git commit . -m "trying to commit to master"
On branch 419cc51c425e6eb1a93061a76a647b031fdf354e


How do I move this commit to the master?










share|improve this question















marked as duplicate by ksav, Mureinik, phd, Community Nov 24 at 13:43


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • Your question is unclear -- what do you mean by managing to get the files (which files) "back working locally"? What branch have you created -- your snippet does not show creating any branch. One branch is always there by default -- master. In any case, you'd have to elaborate on what do you refer to with "rollback" -- there is no such term applicable to Git. Every commit points to a tree -- a snapshot of a directory, if you will. By rolling back, you may be referring to checking out an earlier commit (in time), or discarding all commits after it.
    – amn
    Nov 22 at 12:34










  • Thanks, it's likely unclear, as I'm unclear on this issue. I'm able to get a previous commit working locally. What I would like to do is revert back to a previous commit and disregard commits after that.
    – Rob
    Nov 22 at 12:37










  • If you want to reset your working tree to the tree of an [earlier] commit, moving the pointer that is the current branch to that commit, you need to do a hard reset with git reset --hard <commit>, with <commit> being a reference to the commit you want to revert to. It may be a reference like HEAD~7, meaning that you want to go back to the 7th ancestor of current tip of the branch. I do recommend you take the time to read Git from the Bottom Up for better Git knowledge.
    – amn
    Nov 22 at 12:49










  • A warning is in order though, for hard resets -- a hard reset discards your working tree, meaning that any uncommitted changes you have are lost. Make sure to preserve your working tree prior to a hard reset, if you need to. You can learn about git stash for that purpose, although it's optional as far as saving the working tree goes.
    – amn
    Nov 22 at 12:54












  • If your unwanted changes are in a commit, can you use git revert <commit>? It's even possible for you to revert multiple commits separately and then make a single reversion commit. See: stackoverflow.com/questions/1463340/…
    – ksav
    Nov 22 at 13:01


















-1















This question already has an answer here:




  • How to revert multiple git commits?

    12 answers



  • Move commit to different branch

    2 answers




Trying to revert to a previous Github commit. I'm now really struggling with committing it to the master. I think I've created a branch but can't get my head around how to move this to master from the documentation available.



git add .    
git commit . -m "trying to commit to master"
On branch 419cc51c425e6eb1a93061a76a647b031fdf354e


How do I move this commit to the master?










share|improve this question















marked as duplicate by ksav, Mureinik, phd, Community Nov 24 at 13:43


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • Your question is unclear -- what do you mean by managing to get the files (which files) "back working locally"? What branch have you created -- your snippet does not show creating any branch. One branch is always there by default -- master. In any case, you'd have to elaborate on what do you refer to with "rollback" -- there is no such term applicable to Git. Every commit points to a tree -- a snapshot of a directory, if you will. By rolling back, you may be referring to checking out an earlier commit (in time), or discarding all commits after it.
    – amn
    Nov 22 at 12:34










  • Thanks, it's likely unclear, as I'm unclear on this issue. I'm able to get a previous commit working locally. What I would like to do is revert back to a previous commit and disregard commits after that.
    – Rob
    Nov 22 at 12:37










  • If you want to reset your working tree to the tree of an [earlier] commit, moving the pointer that is the current branch to that commit, you need to do a hard reset with git reset --hard <commit>, with <commit> being a reference to the commit you want to revert to. It may be a reference like HEAD~7, meaning that you want to go back to the 7th ancestor of current tip of the branch. I do recommend you take the time to read Git from the Bottom Up for better Git knowledge.
    – amn
    Nov 22 at 12:49










  • A warning is in order though, for hard resets -- a hard reset discards your working tree, meaning that any uncommitted changes you have are lost. Make sure to preserve your working tree prior to a hard reset, if you need to. You can learn about git stash for that purpose, although it's optional as far as saving the working tree goes.
    – amn
    Nov 22 at 12:54












  • If your unwanted changes are in a commit, can you use git revert <commit>? It's even possible for you to revert multiple commits separately and then make a single reversion commit. See: stackoverflow.com/questions/1463340/…
    – ksav
    Nov 22 at 13:01
















-1












-1








-1








This question already has an answer here:




  • How to revert multiple git commits?

    12 answers



  • Move commit to different branch

    2 answers




Trying to revert to a previous Github commit. I'm now really struggling with committing it to the master. I think I've created a branch but can't get my head around how to move this to master from the documentation available.



git add .    
git commit . -m "trying to commit to master"
On branch 419cc51c425e6eb1a93061a76a647b031fdf354e


How do I move this commit to the master?










share|improve this question
















This question already has an answer here:




  • How to revert multiple git commits?

    12 answers



  • Move commit to different branch

    2 answers




Trying to revert to a previous Github commit. I'm now really struggling with committing it to the master. I think I've created a branch but can't get my head around how to move this to master from the documentation available.



git add .    
git commit . -m "trying to commit to master"
On branch 419cc51c425e6eb1a93061a76a647b031fdf354e


How do I move this commit to the master?





This question already has an answer here:




  • How to revert multiple git commits?

    12 answers



  • Move commit to different branch

    2 answers








git terminal git-commit






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 at 13:26

























asked Nov 22 at 12:29









Rob

21151751




21151751




marked as duplicate by ksav, Mureinik, phd, Community Nov 24 at 13:43


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by ksav, Mureinik, phd, Community Nov 24 at 13:43


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • Your question is unclear -- what do you mean by managing to get the files (which files) "back working locally"? What branch have you created -- your snippet does not show creating any branch. One branch is always there by default -- master. In any case, you'd have to elaborate on what do you refer to with "rollback" -- there is no such term applicable to Git. Every commit points to a tree -- a snapshot of a directory, if you will. By rolling back, you may be referring to checking out an earlier commit (in time), or discarding all commits after it.
    – amn
    Nov 22 at 12:34










  • Thanks, it's likely unclear, as I'm unclear on this issue. I'm able to get a previous commit working locally. What I would like to do is revert back to a previous commit and disregard commits after that.
    – Rob
    Nov 22 at 12:37










  • If you want to reset your working tree to the tree of an [earlier] commit, moving the pointer that is the current branch to that commit, you need to do a hard reset with git reset --hard <commit>, with <commit> being a reference to the commit you want to revert to. It may be a reference like HEAD~7, meaning that you want to go back to the 7th ancestor of current tip of the branch. I do recommend you take the time to read Git from the Bottom Up for better Git knowledge.
    – amn
    Nov 22 at 12:49










  • A warning is in order though, for hard resets -- a hard reset discards your working tree, meaning that any uncommitted changes you have are lost. Make sure to preserve your working tree prior to a hard reset, if you need to. You can learn about git stash for that purpose, although it's optional as far as saving the working tree goes.
    – amn
    Nov 22 at 12:54












  • If your unwanted changes are in a commit, can you use git revert <commit>? It's even possible for you to revert multiple commits separately and then make a single reversion commit. See: stackoverflow.com/questions/1463340/…
    – ksav
    Nov 22 at 13:01




















  • Your question is unclear -- what do you mean by managing to get the files (which files) "back working locally"? What branch have you created -- your snippet does not show creating any branch. One branch is always there by default -- master. In any case, you'd have to elaborate on what do you refer to with "rollback" -- there is no such term applicable to Git. Every commit points to a tree -- a snapshot of a directory, if you will. By rolling back, you may be referring to checking out an earlier commit (in time), or discarding all commits after it.
    – amn
    Nov 22 at 12:34










  • Thanks, it's likely unclear, as I'm unclear on this issue. I'm able to get a previous commit working locally. What I would like to do is revert back to a previous commit and disregard commits after that.
    – Rob
    Nov 22 at 12:37










  • If you want to reset your working tree to the tree of an [earlier] commit, moving the pointer that is the current branch to that commit, you need to do a hard reset with git reset --hard <commit>, with <commit> being a reference to the commit you want to revert to. It may be a reference like HEAD~7, meaning that you want to go back to the 7th ancestor of current tip of the branch. I do recommend you take the time to read Git from the Bottom Up for better Git knowledge.
    – amn
    Nov 22 at 12:49










  • A warning is in order though, for hard resets -- a hard reset discards your working tree, meaning that any uncommitted changes you have are lost. Make sure to preserve your working tree prior to a hard reset, if you need to. You can learn about git stash for that purpose, although it's optional as far as saving the working tree goes.
    – amn
    Nov 22 at 12:54












  • If your unwanted changes are in a commit, can you use git revert <commit>? It's even possible for you to revert multiple commits separately and then make a single reversion commit. See: stackoverflow.com/questions/1463340/…
    – ksav
    Nov 22 at 13:01


















Your question is unclear -- what do you mean by managing to get the files (which files) "back working locally"? What branch have you created -- your snippet does not show creating any branch. One branch is always there by default -- master. In any case, you'd have to elaborate on what do you refer to with "rollback" -- there is no such term applicable to Git. Every commit points to a tree -- a snapshot of a directory, if you will. By rolling back, you may be referring to checking out an earlier commit (in time), or discarding all commits after it.
– amn
Nov 22 at 12:34




Your question is unclear -- what do you mean by managing to get the files (which files) "back working locally"? What branch have you created -- your snippet does not show creating any branch. One branch is always there by default -- master. In any case, you'd have to elaborate on what do you refer to with "rollback" -- there is no such term applicable to Git. Every commit points to a tree -- a snapshot of a directory, if you will. By rolling back, you may be referring to checking out an earlier commit (in time), or discarding all commits after it.
– amn
Nov 22 at 12:34












Thanks, it's likely unclear, as I'm unclear on this issue. I'm able to get a previous commit working locally. What I would like to do is revert back to a previous commit and disregard commits after that.
– Rob
Nov 22 at 12:37




Thanks, it's likely unclear, as I'm unclear on this issue. I'm able to get a previous commit working locally. What I would like to do is revert back to a previous commit and disregard commits after that.
– Rob
Nov 22 at 12:37












If you want to reset your working tree to the tree of an [earlier] commit, moving the pointer that is the current branch to that commit, you need to do a hard reset with git reset --hard <commit>, with <commit> being a reference to the commit you want to revert to. It may be a reference like HEAD~7, meaning that you want to go back to the 7th ancestor of current tip of the branch. I do recommend you take the time to read Git from the Bottom Up for better Git knowledge.
– amn
Nov 22 at 12:49




If you want to reset your working tree to the tree of an [earlier] commit, moving the pointer that is the current branch to that commit, you need to do a hard reset with git reset --hard <commit>, with <commit> being a reference to the commit you want to revert to. It may be a reference like HEAD~7, meaning that you want to go back to the 7th ancestor of current tip of the branch. I do recommend you take the time to read Git from the Bottom Up for better Git knowledge.
– amn
Nov 22 at 12:49












A warning is in order though, for hard resets -- a hard reset discards your working tree, meaning that any uncommitted changes you have are lost. Make sure to preserve your working tree prior to a hard reset, if you need to. You can learn about git stash for that purpose, although it's optional as far as saving the working tree goes.
– amn
Nov 22 at 12:54






A warning is in order though, for hard resets -- a hard reset discards your working tree, meaning that any uncommitted changes you have are lost. Make sure to preserve your working tree prior to a hard reset, if you need to. You can learn about git stash for that purpose, although it's optional as far as saving the working tree goes.
– amn
Nov 22 at 12:54














If your unwanted changes are in a commit, can you use git revert <commit>? It's even possible for you to revert multiple commits separately and then make a single reversion commit. See: stackoverflow.com/questions/1463340/…
– ksav
Nov 22 at 13:01






If your unwanted changes are in a commit, can you use git revert <commit>? It's even possible for you to revert multiple commits separately and then make a single reversion commit. See: stackoverflow.com/questions/1463340/…
– ksav
Nov 22 at 13:01



















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

BM1WnmNuKdXtliGIDzL2mM4sMDE,U8P6 9e3yO O5KLYp9GoKs176K0sz4BQ
z1KxJ QWo qjdRQRqkYp 8D7P4EgGsf 3gE0dPA7UlnLwR5AHP

Popular posts from this blog

Berounka

Sphinx de Gizeh

Mécislas Golberg