Daviepark
Daviepark

Reputation: 65

Work flow for git after pull request

I am new to git and have come up against a scenario I am unfamiliar with.

The scenario is this.

  1. Cloned repo
  2. Made changes
  3. Committed Changes
  4. Created Pull Request in origin/my-new-feature
  5. Deleted local branch my-new-feature
  6. Made more changes
  7. Created PRs for them as well.
  8. I now have to make slight changes to my code in the first PR.

After reading a few articles I believe this would be the way?

Is this the best workflow or am I missing something. I am very new to git.

Upvotes: 0

Views: 42

Answers (1)

Ryan Bigg
Ryan Bigg

Reputation: 107738

You should've kept your first my-new-feature branch. It's best practice to keep these branches around until the pull request is closed or merged.

So to get it back you would do:

  1. git fetch -- to ensure you have the latest branches and their latest commits
  2. git checkout origin/my-new-feature -b my-new-feature

This will then restore the my-new-feature branch on your local machine. Add as many commits as you wish to this branch, then push it again with:

  1. git push or perhaps git push origin my-new-feature. Whichever works.

Upvotes: 1

Related Questions