How to bring a pull request to a state of “can be merged automatically”?

I have branched from dev branch into feature branch and made some commits. Now, when i send a pull request to merge a feature branch into dev branch I notice on github that the branch cannot be merged automatically because of some conflicting changes. What do i need to do in order to bring my feature branch into the state of “can be merged automatically”?

What i currently do is:

  • Is it possible to diff PowerPoint version-controlled with git?
  • multiple heroku accounts not working
  • How to add a file to the first commit on a git repo?
  • Working with a forked git repository, except I cloned the public repo URL, not the private URL
  • Does git pull always create a merge commit?
  • Freeing workflow from CVS concepts/limitations
    1. Checkout the dev branch
    2. Merge feature branch
    3. Remember the lines that caused the conflict
    4. Checkout the feature branch
    5. Manually revert each line to the state of the dev branch
    6. Commit and push the patch

    But this looks like many handwork. So i wondered if this can be simplified somehow?

    UPDATE

    Mind that i would like to keep my feature branch changes isolated from develop branch (for the purpose of keeping track of which branch introduced regressions and testing each new feature in isolation to other features). So, while merging/rebasing dev into feature would solve the problem, it would bring all the changes made in dev into feature and i would loose isolation.

  • Branching and merging best practices in Git
  • How to remove/hide GitExtensions toolbar from Visual Studio?
  • Unable to push app in heroku
  • Git-flow reopening a finished feature
  • composer error while updating “.git directory is missing”
  • Test VM in GIT repository
  • One Solution collect form web for “How to bring a pull request to a state of “can be merged automatically”?”

    Few assumptions: you took a branch out from dev and called it feature and you want to merge feature into dev

    Your branch feature is not mergeable to dev branch because someone has already made changes todev` which cannot be conflict resolved by git automatically.

    In this scenario, there are two approaches that you can take

    1. Rebase – In this case you will follow these steps below
      • checkout dev
      • take pull from remote
      • checkout feature
      • git rebase dev – Internally, this 1) removes all your commits beyond last
        commit where feature and dev were same 2) applies all dev
        commits 3) one by one apply all feature commits – and as an when
        conflicts occur, git prompts you to fix the conflicts. The last step
        repeats until all your commits have been successfully applied back to
        feature branch.
      • Push all changes to feature branch remote
      • Send in a pull request 🙂

    This is the one that I always follow and it is recommended that you keep taking pull from parent branch regularly to avoid conflicts. This creates a diamond structure in git commit history.

    1. The second one is merge, but I use and find rebase much cleaner and use that always.
    Git Baby is a git and github fan, let's start git clone.