Revert everything you did in github
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
add a comment |
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
add a comment |
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
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
github push commit undo revert
asked Nov 11 at 18:30
Nolmegar Whitefury
31
31
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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
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 commandgit 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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
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 commandgit 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
add a comment |
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
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 commandgit 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
add a comment |
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
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
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 commandgit 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
add a comment |
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 commandgit 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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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