gruntwork-io / git-xargs

git-xargs is a command-line tool (CLI) for making updates across multiple Github repositories with a single command.
https://blog.gruntwork.io/introducing-git-xargs-an-open-source-tool-to-update-multiple-github-repos-753f9f3675ec
Apache License 2.0
935 stars 62 forks source link

Question: Can the target branch be specified for the generated PRs? #22

Open prgx-erodri02 opened 3 years ago

prgx-erodri02 commented 3 years ago

git-xargs seems to be exactly what I need to use. I've been testing it to update files and automatically generate pull requests.

What I have seen is that the pull requests generated are always between the branch specified with "--branch-name" and "master".

Is it possible to specify that target branch to be different to "master"? Or a way to specify that the target should be the default branch (which is not always "master" on some of our repos).

Thanks.

zackproser commented 3 years ago

git-xargs seems to be exactly what I need to use. I've been testing it to update files and automatically generate pull requests.

What I have seen is that the pull requests generated are always between the branch specified with "--branch-name" and "master".

Is it possible to specify that target branch to be different to "master"? Or a way to specify that the target should be the default branch (which is not always "master" on some of our repos).

Thanks.

Hi thanks for your question - unfortunately this is currently hardcoded to master - but as this comment suggests there are definitely ways to improve and make this more configurable. We can look to add that flexibility in the future!

radicarl commented 3 years ago

Proposal: Add the branch to the repo string in the repo file like:

gruntwork-io/infrastructure-as-code-training/tree/main
gruntwork-io/infrastructure-live-acme/tree/some-other-branch

This way you could use different base-branches for every repository and the user can copy the url from his browser. Maybe you could ignore https://github.com/ in the beginning, then the user could just navigate to the branch and copy and paste the url.

muhannad0 commented 1 year ago

Quick question for @nirnanaaa or @zackproser about the use of the base branch flag. In the current implementation #64 when overriding with the base-branch flag, is the repo command run against the a branch out from configured base branch or default branch (main/master)?

For example;

git-xargs \
--branch file-update \
--commit-message "file update" \
--repo my-user/my-repo \
--base-branch-name "develop" \
touch file1.txt

Would this be equivalent to the following manual steps?

# clone the repo
git clone my-user/my-repo

# create working branch from provided base branch
git checkout -b file-update develop

# run the provided repo command
touch file1.txt

# commit and push the files
git add .
git commit -m "file update"
git push origin file-update

# create PR from file-update to develop branch

I tried this recently, but I noticed that some additional commits are included in the created PR, while I was expecting only a single commit to be present.