Recover lost data git?How to resolve merge conflicts in GitWhat is the difference between 'git pull' and 'git fetch'?How to undo 'git add' before commit?How do I undo the most recent commits in Git?How do I force “git pull” to overwrite local files?How do you create a remote Git branch?How do I delete a Git branch both locally and remotely?Undo a Git merge that hasn't been pushed yetHow do I push a new local branch to a remote Git repository and track it too?How do I rename a local Git branch?

Can I Retrieve Email Addresses from BCC?

Organic chemistry Iodoform Reaction

How to decode Core DB Account.Signers using the stellar js-sdk

Lifted its hind leg on or lifted its hind leg towards?

Partial sums of primes

How do I repair my stair bannister?

What does the "3am" section means in manpages?

Is there a word to describe the feeling of being transfixed out of horror?

Adding empty element to declared container without declaring type of element

Female=gender counterpart?

How to deal with loss of decision making power over a change?

What is the smallest body in which a sling shot maneuver can be performed?

Is there enough fresh water in the world to eradicate the drinking water crisis?

Lightning Web Components - Not available in app builder

Why isn't KTEX's runway designation 10/28 instead of 9/27?

How do ultrasonic sensors differentiate between transmitted and received signals?

How will losing mobility of one hand affect my career as a programmer?

Blender - show edges angles “direction”

You're three for three

Is there an wasy way to program in Tikz something like the one in the image?

Is it okay / does it make sense for another player to join a running game of Munchkin?

I2C signal and power over long range (10meter cable)

Superhero words!

Should my PhD thesis be submitted under my legal name?



Recover lost data git?


How to resolve merge conflicts in GitWhat is the difference between 'git pull' and 'git fetch'?How to undo 'git add' before commit?How do I undo the most recent commits in Git?How do I force “git pull” to overwrite local files?How do you create a remote Git branch?How do I delete a Git branch both locally and remotely?Undo a Git merge that hasn't been pushed yetHow do I push a new local branch to a remote Git repository and track it too?How do I rename a local Git branch?













-3















After merging feature branches in local (with master) and pushing to remote, an already completed feature lost from master(remote).Is there anyway to recover that lost files?










share|improve this question
























  • There's no verb in the first sentence. What is the lost data you want to recover?

    – RomainValeri
    Mar 21 at 14:12











  • @RomainValeri lost data means some angular files/component for a feature

    – youv
    Mar 21 at 14:16












  • Not any clearer. Sorry, I tap out until a better description.

    – RomainValeri
    Mar 21 at 14:22






  • 2





    The nature of these files is irrelevant here. Might as well be .avi videos, would be the same. My question was : can you clarify where these files come from, what you did, how you merged, and so on.

    – RomainValeri
    Mar 21 at 14:25






  • 1





    The data was almost certainly not lost; it was just superseded by a commit in which those changes/files are not present. If the situation is urgent I suggest you hire a consultant knowledgeable in git to fix up the situation.

    – Kaz
    Mar 22 at 2:59















-3















After merging feature branches in local (with master) and pushing to remote, an already completed feature lost from master(remote).Is there anyway to recover that lost files?










share|improve this question
























  • There's no verb in the first sentence. What is the lost data you want to recover?

    – RomainValeri
    Mar 21 at 14:12











  • @RomainValeri lost data means some angular files/component for a feature

    – youv
    Mar 21 at 14:16












  • Not any clearer. Sorry, I tap out until a better description.

    – RomainValeri
    Mar 21 at 14:22






  • 2





    The nature of these files is irrelevant here. Might as well be .avi videos, would be the same. My question was : can you clarify where these files come from, what you did, how you merged, and so on.

    – RomainValeri
    Mar 21 at 14:25






  • 1





    The data was almost certainly not lost; it was just superseded by a commit in which those changes/files are not present. If the situation is urgent I suggest you hire a consultant knowledgeable in git to fix up the situation.

    – Kaz
    Mar 22 at 2:59













-3












-3








-3








After merging feature branches in local (with master) and pushing to remote, an already completed feature lost from master(remote).Is there anyway to recover that lost files?










share|improve this question
















After merging feature branches in local (with master) and pushing to remote, an already completed feature lost from master(remote).Is there anyway to recover that lost files?







git git-merge






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 21 at 14:22







youv

















asked Mar 21 at 14:07









youvyouv

3511517




3511517












  • There's no verb in the first sentence. What is the lost data you want to recover?

    – RomainValeri
    Mar 21 at 14:12











  • @RomainValeri lost data means some angular files/component for a feature

    – youv
    Mar 21 at 14:16












  • Not any clearer. Sorry, I tap out until a better description.

    – RomainValeri
    Mar 21 at 14:22






  • 2





    The nature of these files is irrelevant here. Might as well be .avi videos, would be the same. My question was : can you clarify where these files come from, what you did, how you merged, and so on.

    – RomainValeri
    Mar 21 at 14:25






  • 1





    The data was almost certainly not lost; it was just superseded by a commit in which those changes/files are not present. If the situation is urgent I suggest you hire a consultant knowledgeable in git to fix up the situation.

    – Kaz
    Mar 22 at 2:59

















  • There's no verb in the first sentence. What is the lost data you want to recover?

    – RomainValeri
    Mar 21 at 14:12











  • @RomainValeri lost data means some angular files/component for a feature

    – youv
    Mar 21 at 14:16












  • Not any clearer. Sorry, I tap out until a better description.

    – RomainValeri
    Mar 21 at 14:22






  • 2





    The nature of these files is irrelevant here. Might as well be .avi videos, would be the same. My question was : can you clarify where these files come from, what you did, how you merged, and so on.

    – RomainValeri
    Mar 21 at 14:25






  • 1





    The data was almost certainly not lost; it was just superseded by a commit in which those changes/files are not present. If the situation is urgent I suggest you hire a consultant knowledgeable in git to fix up the situation.

    – Kaz
    Mar 22 at 2:59
















There's no verb in the first sentence. What is the lost data you want to recover?

– RomainValeri
Mar 21 at 14:12





There's no verb in the first sentence. What is the lost data you want to recover?

– RomainValeri
Mar 21 at 14:12













@RomainValeri lost data means some angular files/component for a feature

– youv
Mar 21 at 14:16






@RomainValeri lost data means some angular files/component for a feature

– youv
Mar 21 at 14:16














Not any clearer. Sorry, I tap out until a better description.

– RomainValeri
Mar 21 at 14:22





Not any clearer. Sorry, I tap out until a better description.

– RomainValeri
Mar 21 at 14:22




2




2





The nature of these files is irrelevant here. Might as well be .avi videos, would be the same. My question was : can you clarify where these files come from, what you did, how you merged, and so on.

– RomainValeri
Mar 21 at 14:25





The nature of these files is irrelevant here. Might as well be .avi videos, would be the same. My question was : can you clarify where these files come from, what you did, how you merged, and so on.

– RomainValeri
Mar 21 at 14:25




1




1





The data was almost certainly not lost; it was just superseded by a commit in which those changes/files are not present. If the situation is urgent I suggest you hire a consultant knowledgeable in git to fix up the situation.

– Kaz
Mar 22 at 2:59





The data was almost certainly not lost; it was just superseded by a commit in which those changes/files are not present. If the situation is urgent I suggest you hire a consultant knowledgeable in git to fix up the situation.

– Kaz
Mar 22 at 2:59












2 Answers
2






active

oldest

votes


















2














You can go back in the git history. E.g.



git reset --soft HEAD~N


where N is number of the recent commits you want to discard. The --soft parameter will keep changes from the remote repo locally on stage. You can also use --hard parameter to remove changes completely (you can always pull them from the remote repo).



Another option is to browse your gitlog with git log command, find a commit, which points to the state before crucial change was made (you can use grep to filter commit messages) and checkout to this commit with the command



git checkout COMMIT_HASH


where COMMIT_HASH is your commit hash



After going back in the history, try to find your lost code. Then, you can either copy it somewhere, perform the git reset --hard, git pull, paste it in the latest source and perform a new commit or try to use cherry pick feature of the git.



Please note, proposed solutions will be feasible only if recent pushes didn't override the repo history (it could happen in the case of push with --force parameter) or they did, but you haven't pulled them yet.



Moreover, remember that git is distributed VCS, so in the case of push with force and pull, you can try to find a colleague from your team, who haven't done the pull and recover history from his local repo.






share|improve this answer
































    0














    The situation is not clear before seeing a tree or merge commands.



    But you can always use git reflog in the local repository who perform merges. You'll see a version of repository before the merge. Assuming that feature/files are on a branch or easy to add into a separate branch; you can simply create a new feature branch from there and push it to remote. While merging newly created branch back to master, probably it'll do the same thing. So it's better to rebase new branch on top of master






    share|improve this answer






















      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%2f55282298%2frecover-lost-data-git%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2














      You can go back in the git history. E.g.



      git reset --soft HEAD~N


      where N is number of the recent commits you want to discard. The --soft parameter will keep changes from the remote repo locally on stage. You can also use --hard parameter to remove changes completely (you can always pull them from the remote repo).



      Another option is to browse your gitlog with git log command, find a commit, which points to the state before crucial change was made (you can use grep to filter commit messages) and checkout to this commit with the command



      git checkout COMMIT_HASH


      where COMMIT_HASH is your commit hash



      After going back in the history, try to find your lost code. Then, you can either copy it somewhere, perform the git reset --hard, git pull, paste it in the latest source and perform a new commit or try to use cherry pick feature of the git.



      Please note, proposed solutions will be feasible only if recent pushes didn't override the repo history (it could happen in the case of push with --force parameter) or they did, but you haven't pulled them yet.



      Moreover, remember that git is distributed VCS, so in the case of push with force and pull, you can try to find a colleague from your team, who haven't done the pull and recover history from his local repo.






      share|improve this answer





























        2














        You can go back in the git history. E.g.



        git reset --soft HEAD~N


        where N is number of the recent commits you want to discard. The --soft parameter will keep changes from the remote repo locally on stage. You can also use --hard parameter to remove changes completely (you can always pull them from the remote repo).



        Another option is to browse your gitlog with git log command, find a commit, which points to the state before crucial change was made (you can use grep to filter commit messages) and checkout to this commit with the command



        git checkout COMMIT_HASH


        where COMMIT_HASH is your commit hash



        After going back in the history, try to find your lost code. Then, you can either copy it somewhere, perform the git reset --hard, git pull, paste it in the latest source and perform a new commit or try to use cherry pick feature of the git.



        Please note, proposed solutions will be feasible only if recent pushes didn't override the repo history (it could happen in the case of push with --force parameter) or they did, but you haven't pulled them yet.



        Moreover, remember that git is distributed VCS, so in the case of push with force and pull, you can try to find a colleague from your team, who haven't done the pull and recover history from his local repo.






        share|improve this answer



























          2












          2








          2







          You can go back in the git history. E.g.



          git reset --soft HEAD~N


          where N is number of the recent commits you want to discard. The --soft parameter will keep changes from the remote repo locally on stage. You can also use --hard parameter to remove changes completely (you can always pull them from the remote repo).



          Another option is to browse your gitlog with git log command, find a commit, which points to the state before crucial change was made (you can use grep to filter commit messages) and checkout to this commit with the command



          git checkout COMMIT_HASH


          where COMMIT_HASH is your commit hash



          After going back in the history, try to find your lost code. Then, you can either copy it somewhere, perform the git reset --hard, git pull, paste it in the latest source and perform a new commit or try to use cherry pick feature of the git.



          Please note, proposed solutions will be feasible only if recent pushes didn't override the repo history (it could happen in the case of push with --force parameter) or they did, but you haven't pulled them yet.



          Moreover, remember that git is distributed VCS, so in the case of push with force and pull, you can try to find a colleague from your team, who haven't done the pull and recover history from his local repo.






          share|improve this answer















          You can go back in the git history. E.g.



          git reset --soft HEAD~N


          where N is number of the recent commits you want to discard. The --soft parameter will keep changes from the remote repo locally on stage. You can also use --hard parameter to remove changes completely (you can always pull them from the remote repo).



          Another option is to browse your gitlog with git log command, find a commit, which points to the state before crucial change was made (you can use grep to filter commit messages) and checkout to this commit with the command



          git checkout COMMIT_HASH


          where COMMIT_HASH is your commit hash



          After going back in the history, try to find your lost code. Then, you can either copy it somewhere, perform the git reset --hard, git pull, paste it in the latest source and perform a new commit or try to use cherry pick feature of the git.



          Please note, proposed solutions will be feasible only if recent pushes didn't override the repo history (it could happen in the case of push with --force parameter) or they did, but you haven't pulled them yet.



          Moreover, remember that git is distributed VCS, so in the case of push with force and pull, you can try to find a colleague from your team, who haven't done the pull and recover history from his local repo.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 21 at 16:21

























          answered Mar 21 at 14:35









          piotr.wittchenpiotr.wittchen

          2,54431528




          2,54431528























              0














              The situation is not clear before seeing a tree or merge commands.



              But you can always use git reflog in the local repository who perform merges. You'll see a version of repository before the merge. Assuming that feature/files are on a branch or easy to add into a separate branch; you can simply create a new feature branch from there and push it to remote. While merging newly created branch back to master, probably it'll do the same thing. So it's better to rebase new branch on top of master






              share|improve this answer



























                0














                The situation is not clear before seeing a tree or merge commands.



                But you can always use git reflog in the local repository who perform merges. You'll see a version of repository before the merge. Assuming that feature/files are on a branch or easy to add into a separate branch; you can simply create a new feature branch from there and push it to remote. While merging newly created branch back to master, probably it'll do the same thing. So it's better to rebase new branch on top of master






                share|improve this answer

























                  0












                  0








                  0







                  The situation is not clear before seeing a tree or merge commands.



                  But you can always use git reflog in the local repository who perform merges. You'll see a version of repository before the merge. Assuming that feature/files are on a branch or easy to add into a separate branch; you can simply create a new feature branch from there and push it to remote. While merging newly created branch back to master, probably it'll do the same thing. So it's better to rebase new branch on top of master






                  share|improve this answer













                  The situation is not clear before seeing a tree or merge commands.



                  But you can always use git reflog in the local repository who perform merges. You'll see a version of repository before the merge. Assuming that feature/files are on a branch or easy to add into a separate branch; you can simply create a new feature branch from there and push it to remote. While merging newly created branch back to master, probably it'll do the same thing. So it's better to rebase new branch on top of master







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 21 at 14:25









                  Doğancan ArabacıDoğancan Arabacı

                  1,623813




                  1,623813



























                      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.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55282298%2frecover-lost-data-git%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

                      How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

                      155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

                      Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?