Revert everything you did in github










0














So, here is a situation. I wrote a lot of code and by the end of the day wanted to commit all that.
The branch situation was such:




master



working_branch*




What I did after that was:




git branch 11_11_2018



git add everything



git commit -m "msg"



git push --set-upstream origin/11_11_2018 (sth like that)



git checkout master
git branch -d 11_11_2018




Now what happened is that I deleted everything I worked on. I'm somewhat new to GitHub and am really afraid to lose all those precious code lines. The problem here was that I meant to checkout 11_11_2018 but didn't and now I don't completely understand what happened. Please, explain what I actually did and how to revert it if possible?










share|improve this question


























    0














    So, here is a situation. I wrote a lot of code and by the end of the day wanted to commit all that.
    The branch situation was such:




    master



    working_branch*




    What I did after that was:




    git branch 11_11_2018



    git add everything



    git commit -m "msg"



    git push --set-upstream origin/11_11_2018 (sth like that)



    git checkout master
    git branch -d 11_11_2018




    Now what happened is that I deleted everything I worked on. I'm somewhat new to GitHub and am really afraid to lose all those precious code lines. The problem here was that I meant to checkout 11_11_2018 but didn't and now I don't completely understand what happened. Please, explain what I actually did and how to revert it if possible?










    share|improve this question
























      0












      0








      0







      So, here is a situation. I wrote a lot of code and by the end of the day wanted to commit all that.
      The branch situation was such:




      master



      working_branch*




      What I did after that was:




      git branch 11_11_2018



      git add everything



      git commit -m "msg"



      git push --set-upstream origin/11_11_2018 (sth like that)



      git checkout master
      git branch -d 11_11_2018




      Now what happened is that I deleted everything I worked on. I'm somewhat new to GitHub and am really afraid to lose all those precious code lines. The problem here was that I meant to checkout 11_11_2018 but didn't and now I don't completely understand what happened. Please, explain what I actually did and how to revert it if possible?










      share|improve this question













      So, here is a situation. I wrote a lot of code and by the end of the day wanted to commit all that.
      The branch situation was such:




      master



      working_branch*




      What I did after that was:




      git branch 11_11_2018



      git add everything



      git commit -m "msg"



      git push --set-upstream origin/11_11_2018 (sth like that)



      git checkout master
      git branch -d 11_11_2018




      Now what happened is that I deleted everything I worked on. I'm somewhat new to GitHub and am really afraid to lose all those precious code lines. The problem here was that I meant to checkout 11_11_2018 but didn't and now I don't completely understand what happened. Please, explain what I actually did and how to revert it if possible?







      github push commit undo revert






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 11 at 18:30









      Nolmegar Whitefury

      31




      31






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Run the following command and you should get back all your code:



          git checkout -b 11_11_2018 origin/11_11_2018



          What you did was pushed all your code to remote branch, switched to master, deleted local branch.



          The above command will switch to your remote branch and fetch all your changes with it






          share|improve this answer




















          • So, I should be able to see the code the way it should be in my github repository in the 11_11_2018 branch then, right? I'm asking because branch 11_11_2018 on github is equivalent to master and is lacking all the code I wrote.
            – Nolmegar Whitefury
            Nov 11 at 18:40










          • Why is it lacking all the code? You mentioned in the question that you ran this command git push --set-upstream origin/11_11_2018. If you ran this, the code should be in the remote branch on github
            – Pankaj Singhal
            Nov 11 at 19:02










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53251858%2frevert-everything-you-did-in-github%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Run the following command and you should get back all your code:



          git checkout -b 11_11_2018 origin/11_11_2018



          What you did was pushed all your code to remote branch, switched to master, deleted local branch.



          The above command will switch to your remote branch and fetch all your changes with it






          share|improve this answer




















          • So, I should be able to see the code the way it should be in my github repository in the 11_11_2018 branch then, right? I'm asking because branch 11_11_2018 on github is equivalent to master and is lacking all the code I wrote.
            – Nolmegar Whitefury
            Nov 11 at 18:40










          • Why is it lacking all the code? You mentioned in the question that you ran this command git push --set-upstream origin/11_11_2018. If you ran this, the code should be in the remote branch on github
            – Pankaj Singhal
            Nov 11 at 19:02















          0














          Run the following command and you should get back all your code:



          git checkout -b 11_11_2018 origin/11_11_2018



          What you did was pushed all your code to remote branch, switched to master, deleted local branch.



          The above command will switch to your remote branch and fetch all your changes with it






          share|improve this answer




















          • So, I should be able to see the code the way it should be in my github repository in the 11_11_2018 branch then, right? I'm asking because branch 11_11_2018 on github is equivalent to master and is lacking all the code I wrote.
            – Nolmegar Whitefury
            Nov 11 at 18:40










          • Why is it lacking all the code? You mentioned in the question that you ran this command git push --set-upstream origin/11_11_2018. If you ran this, the code should be in the remote branch on github
            – Pankaj Singhal
            Nov 11 at 19:02













          0












          0








          0






          Run the following command and you should get back all your code:



          git checkout -b 11_11_2018 origin/11_11_2018



          What you did was pushed all your code to remote branch, switched to master, deleted local branch.



          The above command will switch to your remote branch and fetch all your changes with it






          share|improve this answer












          Run the following command and you should get back all your code:



          git checkout -b 11_11_2018 origin/11_11_2018



          What you did was pushed all your code to remote branch, switched to master, deleted local branch.



          The above command will switch to your remote branch and fetch all your changes with it







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 11 at 18:33









          Pankaj Singhal

          6,20352244




          6,20352244











          • So, I should be able to see the code the way it should be in my github repository in the 11_11_2018 branch then, right? I'm asking because branch 11_11_2018 on github is equivalent to master and is lacking all the code I wrote.
            – Nolmegar Whitefury
            Nov 11 at 18:40










          • Why is it lacking all the code? You mentioned in the question that you ran this command git push --set-upstream origin/11_11_2018. If you ran this, the code should be in the remote branch on github
            – Pankaj Singhal
            Nov 11 at 19:02
















          • So, I should be able to see the code the way it should be in my github repository in the 11_11_2018 branch then, right? I'm asking because branch 11_11_2018 on github is equivalent to master and is lacking all the code I wrote.
            – Nolmegar Whitefury
            Nov 11 at 18:40










          • Why is it lacking all the code? You mentioned in the question that you ran this command git push --set-upstream origin/11_11_2018. If you ran this, the code should be in the remote branch on github
            – Pankaj Singhal
            Nov 11 at 19:02















          So, I should be able to see the code the way it should be in my github repository in the 11_11_2018 branch then, right? I'm asking because branch 11_11_2018 on github is equivalent to master and is lacking all the code I wrote.
          – Nolmegar Whitefury
          Nov 11 at 18:40




          So, I should be able to see the code the way it should be in my github repository in the 11_11_2018 branch then, right? I'm asking because branch 11_11_2018 on github is equivalent to master and is lacking all the code I wrote.
          – Nolmegar Whitefury
          Nov 11 at 18:40












          Why is it lacking all the code? You mentioned in the question that you ran this command git push --set-upstream origin/11_11_2018. If you ran this, the code should be in the remote branch on github
          – Pankaj Singhal
          Nov 11 at 19:02




          Why is it lacking all the code? You mentioned in the question that you ran this command git push --set-upstream origin/11_11_2018. If you ran this, the code should be in the remote branch on github
          – Pankaj Singhal
          Nov 11 at 19:02

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53251858%2frevert-everything-you-did-in-github%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Darth Vader #20

          How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

          Ondo