I have already committed a file in Gerrit(pushed it), but I think, I, unfortunately, deleted that branch locally from which I committed. How to fix that? Please help.
I tried
git branch --contains 31436fd7200566967f85bfb1ee5425f9b599b908
but it shows
error: no such commit 31436fd7200566967f85bfb1ee5425f9b599b908
Edit: Yes I've git installed locally and I worked on the branch locally.
I got commit id from the Gerrit site, I've committed.
Okay, two days ago first there was a problem when I tried to commit the change, say A. I tried to submit it using "./logerrit submit master" but all I got was:
Counting objects: 32, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (32/32), done.
Writing objects: 100% (32/32), 100.46 KiB | 0 bytes/s, done.
Total 32 (delta 22), reused 0 (delta 0)
remote: Resolving deltas: 100% (22/22)
remote: Counting objects: 79789, done
remote: Processing changes: refs: 1, done
To ssh://logerrit/core
! [remote rejected] HEAD -> refs/for/master (change
https://gerrit.libreoffice.org/54112 closed)
error: failed to push some refs to 'ssh://logerrit/core'
So, it says that change id is same for two commits- the patch I'm committing and the patch that was already committed by me a few days ago and is merged now. I tried to do every possible thing which is mentioned on stack overflow or any other blogs- I tried to change the id, such that on next "git commit --amend" git automatically change the id, it was of no use as I was getting the same error, I also tried to fix the conflicts by removing the lines <<<<<<<<<<< ============ and >>>>>>>>>>> but am I correct with it? Is it the right way to resolve it? I then tried to "git rebase master" and then I got the error message:
First, rewinding head to replay your work on top of it...
Applying: smartart : test documents
Using index info to reconstruct a base tree...
M sd/qa/unit/import-tests-smartart.cxx
Falling back to patching base and 3-way merge...
Auto-merging sd/qa/unit/import-tests-smartart.cxx
CONFLICT (content): Merge conflict in sd/qa/unit/import-tests-
smartart.cxx
error: Failed to merge in the changes.
Patch failed at 0001 smartart : test documents
The copy of the patch that failed is found in: .git/rebase-
apply/patch
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
I tried to change the branch, and then tried to again rebase the changes with the master as it was already up-to-date, but It was of no use. I then deleted the extra branches "locally" I created, and by mistake, I might have deleted one of the branch from which I've committed to Gerrit.
Now my question is:
- Can I get my deleted branch restored again in my local system? Is it possible?
- How to resolve merge issues or the error you saw after rebasing. I have a strong doubt, I might be doing wrong something. Please help and please let me know if I didn't cover anything.
Both first and second questions are related to differnt files/branch, but could be related to each other.