Is there a “git pull –dry-run” option in Git?

I have always relied on the inherent abilities of Git to get me back if a merge fails.

To estimate how the merge might occur, you can start like you did with:

$ git fetch origin branch  # Fetch changes, but don't merge
$ git diff HEAD..origin/branch # Diff your current head to the fetched commit

... personal judgement of potential merge conflicts ...

$ git merge origin/branch # merge with the fetched commit

If things did not go as planned, look at your reflog and reset back to your desired state:

$ git reflog
...
abc987  HEAD@{0}: merge activity
b58aae8 HEAD@{1}: fetch origin/branch
8f3a362 HEAD@{2}: activity before the fetch
...
$ git reset --hard HEAD{2}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)