changes and modified files larger doing a PR from a Fork
up vote
0
down vote
favorite
At our work we have a policy where the final code is in master in a repo, and everyone has to make a fork and then make a PR to push the changes.
I'm using syncing-a-fork for my workflow, doing all my changes locally in master and then doing the PR. This was OK until I started creating branches locally, basically my flow with a branch was like this:
git fetch upstream
git checkout master
git merge upstream/master
git checkout -b feature
With that my intent was get all the latest changes from master, then I created a new Branch and start to commit locally my changes. After I finished with my feature I tried to get all the commits made to master so i did this:
git fetch upstream
git checkout master
git merge upstream/master
git push master
git checkout my-branch
git merge master
And then push my changes to github and from there create the PR, the problem with this is that the PR marks as "modified files" my changes and all the changes from the commits, so instead of 20 modified files I see something like 200.
What is the correct flow to follow in this case?
Thanks
git
add a comment |
up vote
0
down vote
favorite
At our work we have a policy where the final code is in master in a repo, and everyone has to make a fork and then make a PR to push the changes.
I'm using syncing-a-fork for my workflow, doing all my changes locally in master and then doing the PR. This was OK until I started creating branches locally, basically my flow with a branch was like this:
git fetch upstream
git checkout master
git merge upstream/master
git checkout -b feature
With that my intent was get all the latest changes from master, then I created a new Branch and start to commit locally my changes. After I finished with my feature I tried to get all the commits made to master so i did this:
git fetch upstream
git checkout master
git merge upstream/master
git push master
git checkout my-branch
git merge master
And then push my changes to github and from there create the PR, the problem with this is that the PR marks as "modified files" my changes and all the changes from the commits, so instead of 20 modified files I see something like 200.
What is the correct flow to follow in this case?
Thanks
git
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
At our work we have a policy where the final code is in master in a repo, and everyone has to make a fork and then make a PR to push the changes.
I'm using syncing-a-fork for my workflow, doing all my changes locally in master and then doing the PR. This was OK until I started creating branches locally, basically my flow with a branch was like this:
git fetch upstream
git checkout master
git merge upstream/master
git checkout -b feature
With that my intent was get all the latest changes from master, then I created a new Branch and start to commit locally my changes. After I finished with my feature I tried to get all the commits made to master so i did this:
git fetch upstream
git checkout master
git merge upstream/master
git push master
git checkout my-branch
git merge master
And then push my changes to github and from there create the PR, the problem with this is that the PR marks as "modified files" my changes and all the changes from the commits, so instead of 20 modified files I see something like 200.
What is the correct flow to follow in this case?
Thanks
git
At our work we have a policy where the final code is in master in a repo, and everyone has to make a fork and then make a PR to push the changes.
I'm using syncing-a-fork for my workflow, doing all my changes locally in master and then doing the PR. This was OK until I started creating branches locally, basically my flow with a branch was like this:
git fetch upstream
git checkout master
git merge upstream/master
git checkout -b feature
With that my intent was get all the latest changes from master, then I created a new Branch and start to commit locally my changes. After I finished with my feature I tried to get all the commits made to master so i did this:
git fetch upstream
git checkout master
git merge upstream/master
git push master
git checkout my-branch
git merge master
And then push my changes to github and from there create the PR, the problem with this is that the PR marks as "modified files" my changes and all the changes from the commits, so instead of 20 modified files I see something like 200.
What is the correct flow to follow in this case?
Thanks
git
git
asked Nov 22 at 17:12
Juan Zamudio
133629
133629
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
You probably want to "rebase" your changes on top of the latest commit in master
:
git checkout my-branch
git fetch upstream
git rebase upstream/master
That is, the commits you made in your branch will appear as if they had been made on top of what's currently in master
. If there are any conflicts between your branch and master
, git rebase
will prompt you to resolve them before proceeding.
Alternatively, if the changes that have been made to master
while you were working on your branch are small, you can just create a PR from your branch without merging/rebasing.
The "syncing a fork" workflow is suitable when you have two branches, slightly different from each other, that you want to keep up-to-date over a longer period of time. That doesn't apply in this case: you create a feature branch, open a PR, PR gets merged, and then you delete the feature branch.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53435663%2fchanges-and-modified-files-larger-doing-a-pr-from-a-fork%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
You probably want to "rebase" your changes on top of the latest commit in master
:
git checkout my-branch
git fetch upstream
git rebase upstream/master
That is, the commits you made in your branch will appear as if they had been made on top of what's currently in master
. If there are any conflicts between your branch and master
, git rebase
will prompt you to resolve them before proceeding.
Alternatively, if the changes that have been made to master
while you were working on your branch are small, you can just create a PR from your branch without merging/rebasing.
The "syncing a fork" workflow is suitable when you have two branches, slightly different from each other, that you want to keep up-to-date over a longer period of time. That doesn't apply in this case: you create a feature branch, open a PR, PR gets merged, and then you delete the feature branch.
add a comment |
up vote
1
down vote
accepted
You probably want to "rebase" your changes on top of the latest commit in master
:
git checkout my-branch
git fetch upstream
git rebase upstream/master
That is, the commits you made in your branch will appear as if they had been made on top of what's currently in master
. If there are any conflicts between your branch and master
, git rebase
will prompt you to resolve them before proceeding.
Alternatively, if the changes that have been made to master
while you were working on your branch are small, you can just create a PR from your branch without merging/rebasing.
The "syncing a fork" workflow is suitable when you have two branches, slightly different from each other, that you want to keep up-to-date over a longer period of time. That doesn't apply in this case: you create a feature branch, open a PR, PR gets merged, and then you delete the feature branch.
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
You probably want to "rebase" your changes on top of the latest commit in master
:
git checkout my-branch
git fetch upstream
git rebase upstream/master
That is, the commits you made in your branch will appear as if they had been made on top of what's currently in master
. If there are any conflicts between your branch and master
, git rebase
will prompt you to resolve them before proceeding.
Alternatively, if the changes that have been made to master
while you were working on your branch are small, you can just create a PR from your branch without merging/rebasing.
The "syncing a fork" workflow is suitable when you have two branches, slightly different from each other, that you want to keep up-to-date over a longer period of time. That doesn't apply in this case: you create a feature branch, open a PR, PR gets merged, and then you delete the feature branch.
You probably want to "rebase" your changes on top of the latest commit in master
:
git checkout my-branch
git fetch upstream
git rebase upstream/master
That is, the commits you made in your branch will appear as if they had been made on top of what's currently in master
. If there are any conflicts between your branch and master
, git rebase
will prompt you to resolve them before proceeding.
Alternatively, if the changes that have been made to master
while you were working on your branch are small, you can just create a PR from your branch without merging/rebasing.
The "syncing a fork" workflow is suitable when you have two branches, slightly different from each other, that you want to keep up-to-date over a longer period of time. That doesn't apply in this case: you create a feature branch, open a PR, PR gets merged, and then you delete the feature branch.
answered Nov 22 at 17:27
legoscia
28.2k1179110
28.2k1179110
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53435663%2fchanges-and-modified-files-larger-doing-a-pr-from-a-fork%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown