Merge current branch into HEAD

Master HEAD has a few changes and I’m trying to merge my current local changes with the Head.
Suppose I have conflicting changes. git just refuses to pull.

It says I have conflicting changes, so in this case I expect it to tell me the files that have conflicts but it expects me to revert my local changes and then pull

  • Git tab completion in zsh throwing errors
  • Git diff in summary?
  • Problems with installation of Android Studio on Windows 10
  • bitbucket git commits missing
  • ssh key passphrase works in windows but not in linux
  • Follow renames when performing git subtree split
  •      Master 
         /    \
      branch1  branch2 (local)
          \
       Master 
    

    When branch2 tries to commit changes to master fails. What should I do in this case? Manually copy files to some location, pull and the then use winmerge to merge the files? or is there a better way to to merge?

    When I do a git pull, it states that – local changes will be overwritten, so stash or commit the changes before pull.

    When I stash or commit the changes, and then pull stash pop fails stating that the changes in working copy will be overwritten.

    BTW, I never see a file with conflicts in either of the cases, even when I try a rebase.

  • How to delete commit from locat git repository at phpstorm?
  • Make git undo any whitespace-only changes?
  • Access different branches during a git merge conflict
  • git aws.push: 'aws.push' is not a git command
  • Where in repository to store test data?
  • Timestamps in Git
  • 2 Solutions collect form web for “Merge current branch into HEAD”

    The answer to this question is hidden in plain view in the documentation. From git help merge:


    HOW TO RESOLVE CONFLICTS

    After seeing a conflict, you can do two things:

    • Decide not to merge. The only clean-ups you need are to reset the index file to the HEAD commit to reverse 2. and to clean up working tree changes made
      by 2. and 3.; git merge --abort can be used for this.

    • Resolve the conflicts. Git will mark the conflicts in the working tree. Edit the files into shape and git add them to the index. Use git commit to seal
      the deal.

    You can work through the conflict with a number of tools:

    • Use a mergetool. git mergetool to launch a graphical mergetool which will work you through the merge.

    • Look at the diffs. git diff will show a three-way diff, highlighting changes from both the HEAD and MERGE_HEAD versions.

    • Look at the diffs from each branch. git log --merge -p <path> will show diffs first for the HEAD version and then the MERGE_HEAD version.

    • Look at the originals. git show :1:filename shows the common ancestor, git show :2:filename shows the HEAD version, and git show :3:filename shows the
      MERGE_HEAD version.

    Looks like the best way to work with GIT is have branches.

    Branch 1
    GIT Commit
    GIT PUSH
    GIT MERGE master ( to fetch the newer changes)

    Branch 2
    GIT Commit
    GIT PUSH

    master
    GIT Merge branch1
    GIT Merge branch2

    I dont think there any other way. Please correct me if i am wrong?

    Is this correct, If yes, in this case working with branches is smooth!

    Git Baby is a git and github fan, let's start git clone.