modelcontextprotocol / modelcontextprotocol/servers
[git] Get parent branch and diff since it (suggestion included)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 90.5k
- Forks
- 11.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 5
Description
I use AI to review merge requests. The assistants I use all support git natively. However, they don't know how to check all changes since the parent branch, because the "parent branch" is not a standard git concept.
So every time I just give the AI the parent branch name or the command to get it.
It would be nice if the git MCP offered this function.
Here is the command I use; I think it is a reasonable definition of a parent branch:
Find the first commit on the current branch that is on a branch other than the current branch or any remote with the same name.
Print the name of any such branch.
current_branch=$(git rev-parse --abbrev-ref HEAD) && \
for commit in $(git rev-list HEAD); do \
other_branch=$(git branch -a --contains $commit | \
/usr/bin/grep -Ev -m 1 "^[ *]*(remotes/.*/)?$current_branch$" | \
sed -r 's#^[ *]*(remotes/)?##' | \
xargs); \
[[ -n "$other_branch" ]] && echo "$other_branch" && break; \
done
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the git MCP server and its existing tool definitions, then compare how current tools expose repository history. Use the supplied shell command as the behavioral reference; done means a tool can identify the parent branch and report the diff since it, following the stated branch-filtering rule.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, typescript
- Domain
- cli, devtools
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100