0

I got pulled off of one task A to fix an urgent bug - task B.

I created a new branch for task B but that contained some new files that I was working on from task A (I messed up the branch creation here I guess). Both branches were based on develop.

Anyway when it came to create the pull request for task B I deleted the new (task A) files committed then created the pull request.

So now I want to pull for develop. I know this will update my task A branch - so will probably delete the new files I created.

How do I do the equivalent of:

git pull origin develop 

while keeping the new files?

halfer
  • 19,824
  • 17
  • 99
  • 186
wobbily_col
  • 11,390
  • 12
  • 62
  • 86
  • Possible duplicate of [How to 'git pull' into a branch that is not the current one?](https://stackoverflow.com/questions/18994609/how-to-git-pull-into-a-branch-that-is-not-the-current-one) – underscore_d Apr 17 '18 at 12:50
  • I suspected there would already be an answer, but searching came up with a LOT of answers most of which weren't relevant. – wobbily_col Apr 17 '18 at 13:17
  • And is that one? – underscore_d Apr 17 '18 at 13:22
  • 1
    Not 100%, but its given me enough of an idea to get things working). – wobbily_col Apr 17 '18 at 13:36
  • Pro tip: the community has [discussed adding home-made tags to titles](https://meta.stackoverflow.com/q/253028), and has agreed we'd rather titles were sentences or questions in ordinary English. Keywords can either be fitted into titles in an organic fashion, or saved for the tags proper. Thanks! – halfer Apr 17 '18 at 22:14

1 Answers1

1

I would start by cloning a clean workspace. Checkout the correct point where the task B branch was supposed to be located. Create a branch, task B2. Now merge in changes from your bad branch into the new branch.

After you have everything the way you like, then you can delete the previously created task B branch.

Timothy Prime
  • 136
  • 1
  • 11
  • I think I'll create a backup branch of my my task A. Do the pull on task A then cherry pick from the backup to restore the deleted files. (Our build system likes to have specific name formats, so its nice to use the one I have for task A). – wobbily_col Apr 17 '18 at 13:38