Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Umgang mit PR, lokal testen #17

Open
BugBuster1701 opened this issue Dec 7, 2017 · 0 comments
Open

Umgang mit PR, lokal testen #17

BugBuster1701 opened this issue Dec 7, 2017 · 0 comments

Comments

@BugBuster1701
Copy link
Owner

in der .bashrc

#  Fetch a github pull request from <remote> and check it out locally in a branch named <remote>-pr-<pr number>
function gitpr ()
{
	if [ -z "$2" ]; then
		echo "Usage: gitpr <remote> <pr number>"
	else
		git fetch $1 pull/$2/head:$1-pr-$2 && git checkout $1-pr-$2
	fi
}
# You are on a feature branch which has been merged upstream, so checkout master, blast the old branch and sync up.
function gitpr-done ()
{
	cb=$(git rev-parse --abbrev-ref HEAD) # parse the ID of the current branch
	git checkout master
	git branch -D ${cb}
	git pull --ff-only upstream master && git push origin master --no-verify
}

oder als alias, über id PR id:

git config --global --add alias.pr '!f() { git fetch -fu ${2:-upstream} refs/pull/$1/head:pr/$1 && git checkout pr/$1; }; f'

git config --global --add alias.pr-clean '!git checkout master ; git for-each-ref refs/heads/pr/* --format="%(refname)" | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done'

Pull ein Pull Request: git pr <id>

Alle PRs löschen, die mit git pr .. angelegt wurden: git pr-clean

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant