简体   繁体   中英

git diff local vs remote feature branch

My local feature branch, named pencils, is ahead by 3 commits. I want to do a diff with remote, also named pencil. How might I do this successfully?

The following failed

git fetch origin pencil:pencil

It failed with error: "refusing to fetch into current branch... of non-bare repository."

If you want to diff your local branch vs the remote branch, do a normal fetch (updates your tracking-branch) and then diff it:

git fetch
git diff pencils origin/pencils

This will show what changed from pencils to the remote pencils branch (assuming the default remote name of origin given in your question)

Short answer:

Branch off from pencil and push the new branch to the server, then on the server pull from the new remote to remote pencil but don't submit the merge and just view the diff?

Another option is to diff your local pencil with HEAD~3 (means "current pencil" vs "current pencil minus 3 commits")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM