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?
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
|
show 2 more comments
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
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 ingitto fix up the situation.
– Kaz
Mar 22 at 2:59
|
show 2 more comments
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
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
git git-merge
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 ingitto fix up the situation.
– Kaz
Mar 22 at 2:59
|
show 2 more comments
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 ingitto 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
|
show 2 more comments
2 Answers
2
active
oldest
votes
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.
add a comment |
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
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%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
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.
add a comment |
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.
add a comment |
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.
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.
edited Mar 21 at 16:21
answered Mar 21 at 14:35
piotr.wittchenpiotr.wittchen
2,54431528
2,54431528
add a comment |
add a comment |
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
add a comment |
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
add a comment |
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
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
answered Mar 21 at 14:25
Doğancan ArabacıDoğancan Arabacı
1,623813
1,623813
add a comment |
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.
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%2f55282298%2frecover-lost-data-git%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
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
gitto fix up the situation.– Kaz
Mar 22 at 2:59