- Ran
git log
, which showed following
commit on master( in my case, it is develop branch) a867b4af366350be2e7c21b8de9cc6504678a61b`
Author: Me <me@me.com>
Date: Thu Nov 4 18:59:41 2010 -0400
blah blah blah...
commit 25eee4caef46ae64aa08e8ab3f988bc917ee1ce4
Author: Me <me@me.com>
Date: Thu Nov 4 05:13:39 2010 -0400
more blah blah blah...
commit 0766c053c0ea2035e90f504928f8df3c9363b8bd
Author: Me <me@me.com>
Date: Thu Nov 4 00:55:06 2010 -0400
And yet more blah blah...
commit 0d1d7fc32e5a947fbd92ee598033d85bfc445a50
Author: Me <me@me.com>
Date: Wed Nov 3 23:56:08 2010 -0400
Yep, more blah blah.
As I'm not able to revert or reset my master branch to certain commit, created a new branch from the old commit, which contains the deleted branch by running following command
git checkout -b "branch_name" 0d1d7fc32e5a947fbd92ee598033d85bfc445a50
USING git hash of 03 November 2010, created a new branch (this commit contains the xyz.java file which does not exist in the latest commit on master (develop) branch)
- Do not have any more changes to make in this new branch (created in step 2 above). purpose of creating this new branch was to revert the xyz.java file, which has been deleted in master. Pushed this new branch to remote.
Git does not allow me to create a PR for this new branch as it shows an error that this new branch does not contain any change, which is not already contained in develop.
If I rebase my new branch with master (develop, in my case) by running following command, it deletes xyz.java file from my new branch.
git pull origin develop
How do you get xyz.java file back in my new branch, which allows git to recognise this new branch contains xyz.java file, which has been deleted in master branch?