Compare files between production-files and repository
I've gotten a bunch of productions-files sent over (a big-ass zip-file). I don't know, if there have been any modification in those files or not.
I have version-control on those files, using Bitbucket.
I'm looking for a way to tell git something along these lines:
Yo Git! You know all those files in this directory here (
/foo
)? Can I get you to, initially disregard all the files that you have in your.gitignore
-file... And after that, compare/foo
withorigin/master
, and create a merge-conflict if there are any differences.
I did this, and it worked. But it that really the correct approach? ... Are there a better/faster/cleaner way of doing it?
- Unpack zip-file.
- Enter it, and do
git init
. - Make a new branch:
git checkout -b myNewBranch
. - Add a .gitignore-file manually (from the
origin/master
-branch). - Commit it:
git commit -m 'Preping for changes'
. - Push it:
git push origin myNewBranch
. - Pull all branches (get my master-branch locally):
git pull -a
- Change to master-branch:
git checkout master
- Merge the two, and allow unrelated histories:
git merge myNewBranch --allow-unrelated-histories
. - Resolve the potential merge-conflict.
- Commit and push it all:
git commit -m 'Production and master merge' && git push
Addition1
Based on what I wrote, then Jonas' comment would work (quite nicely, I assume). However, - I'm using a local development tool, that sets up a virtual environment, and a base-file structure - and then I can import the zip-file, so it's rolls it out on top of the base-file structure. And then I want to compare that with my Bitbucket-branch. I could try to move all the files out of the local development tool (so it's just a blank folder), - and then clone the repository to the local development root, - and then copy the production-files back and overwrite all the files and see which files has changes. But I'm afraid of messing too much with the local development tool, afraid that it'll break.
git
add a comment |
I've gotten a bunch of productions-files sent over (a big-ass zip-file). I don't know, if there have been any modification in those files or not.
I have version-control on those files, using Bitbucket.
I'm looking for a way to tell git something along these lines:
Yo Git! You know all those files in this directory here (
/foo
)? Can I get you to, initially disregard all the files that you have in your.gitignore
-file... And after that, compare/foo
withorigin/master
, and create a merge-conflict if there are any differences.
I did this, and it worked. But it that really the correct approach? ... Are there a better/faster/cleaner way of doing it?
- Unpack zip-file.
- Enter it, and do
git init
. - Make a new branch:
git checkout -b myNewBranch
. - Add a .gitignore-file manually (from the
origin/master
-branch). - Commit it:
git commit -m 'Preping for changes'
. - Push it:
git push origin myNewBranch
. - Pull all branches (get my master-branch locally):
git pull -a
- Change to master-branch:
git checkout master
- Merge the two, and allow unrelated histories:
git merge myNewBranch --allow-unrelated-histories
. - Resolve the potential merge-conflict.
- Commit and push it all:
git commit -m 'Production and master merge' && git push
Addition1
Based on what I wrote, then Jonas' comment would work (quite nicely, I assume). However, - I'm using a local development tool, that sets up a virtual environment, and a base-file structure - and then I can import the zip-file, so it's rolls it out on top of the base-file structure. And then I want to compare that with my Bitbucket-branch. I could try to move all the files out of the local development tool (so it's just a blank folder), - and then clone the repository to the local development root, - and then copy the production-files back and overwrite all the files and see which files has changes. But I'm afraid of messing too much with the local development tool, afraid that it'll break.
git
1
Your approach is a bit more involved than what I would've proposed: just unpack the zip inside the local repos, overwriting all the files. Then,git diff
will tell you which files in the working tree have changes compared tomaster
and you can still commit them. Also, no manual copying of.gitignore
. Haven't tried it but that should do the trick, no?
– Jonas
Jan 19 at 14:32
I added some additional information to the question. Your suggestion would have worked under normal circumstance, I think.
– Zeth
Jan 19 at 15:00
Even with your addition1, I think @Jonas is right: setup everything using agit clone
and whatever else your development tool sets up, then overwrite the local files with the contents of the zip andgit diff
etc will work. If you're worried about messing things up, do it all in a fresh sandbox that you're willing to throw away. As long as you don't commit and push anything, there will be no impact outside the sandbox.
– joanis
Jan 19 at 17:16
add a comment |
I've gotten a bunch of productions-files sent over (a big-ass zip-file). I don't know, if there have been any modification in those files or not.
I have version-control on those files, using Bitbucket.
I'm looking for a way to tell git something along these lines:
Yo Git! You know all those files in this directory here (
/foo
)? Can I get you to, initially disregard all the files that you have in your.gitignore
-file... And after that, compare/foo
withorigin/master
, and create a merge-conflict if there are any differences.
I did this, and it worked. But it that really the correct approach? ... Are there a better/faster/cleaner way of doing it?
- Unpack zip-file.
- Enter it, and do
git init
. - Make a new branch:
git checkout -b myNewBranch
. - Add a .gitignore-file manually (from the
origin/master
-branch). - Commit it:
git commit -m 'Preping for changes'
. - Push it:
git push origin myNewBranch
. - Pull all branches (get my master-branch locally):
git pull -a
- Change to master-branch:
git checkout master
- Merge the two, and allow unrelated histories:
git merge myNewBranch --allow-unrelated-histories
. - Resolve the potential merge-conflict.
- Commit and push it all:
git commit -m 'Production and master merge' && git push
Addition1
Based on what I wrote, then Jonas' comment would work (quite nicely, I assume). However, - I'm using a local development tool, that sets up a virtual environment, and a base-file structure - and then I can import the zip-file, so it's rolls it out on top of the base-file structure. And then I want to compare that with my Bitbucket-branch. I could try to move all the files out of the local development tool (so it's just a blank folder), - and then clone the repository to the local development root, - and then copy the production-files back and overwrite all the files and see which files has changes. But I'm afraid of messing too much with the local development tool, afraid that it'll break.
git
I've gotten a bunch of productions-files sent over (a big-ass zip-file). I don't know, if there have been any modification in those files or not.
I have version-control on those files, using Bitbucket.
I'm looking for a way to tell git something along these lines:
Yo Git! You know all those files in this directory here (
/foo
)? Can I get you to, initially disregard all the files that you have in your.gitignore
-file... And after that, compare/foo
withorigin/master
, and create a merge-conflict if there are any differences.
I did this, and it worked. But it that really the correct approach? ... Are there a better/faster/cleaner way of doing it?
- Unpack zip-file.
- Enter it, and do
git init
. - Make a new branch:
git checkout -b myNewBranch
. - Add a .gitignore-file manually (from the
origin/master
-branch). - Commit it:
git commit -m 'Preping for changes'
. - Push it:
git push origin myNewBranch
. - Pull all branches (get my master-branch locally):
git pull -a
- Change to master-branch:
git checkout master
- Merge the two, and allow unrelated histories:
git merge myNewBranch --allow-unrelated-histories
. - Resolve the potential merge-conflict.
- Commit and push it all:
git commit -m 'Production and master merge' && git push
Addition1
Based on what I wrote, then Jonas' comment would work (quite nicely, I assume). However, - I'm using a local development tool, that sets up a virtual environment, and a base-file structure - and then I can import the zip-file, so it's rolls it out on top of the base-file structure. And then I want to compare that with my Bitbucket-branch. I could try to move all the files out of the local development tool (so it's just a blank folder), - and then clone the repository to the local development root, - and then copy the production-files back and overwrite all the files and see which files has changes. But I'm afraid of messing too much with the local development tool, afraid that it'll break.
git
git
edited Jan 19 at 15:00
Zeth
asked Jan 19 at 14:23
ZethZeth
67611532
67611532
1
Your approach is a bit more involved than what I would've proposed: just unpack the zip inside the local repos, overwriting all the files. Then,git diff
will tell you which files in the working tree have changes compared tomaster
and you can still commit them. Also, no manual copying of.gitignore
. Haven't tried it but that should do the trick, no?
– Jonas
Jan 19 at 14:32
I added some additional information to the question. Your suggestion would have worked under normal circumstance, I think.
– Zeth
Jan 19 at 15:00
Even with your addition1, I think @Jonas is right: setup everything using agit clone
and whatever else your development tool sets up, then overwrite the local files with the contents of the zip andgit diff
etc will work. If you're worried about messing things up, do it all in a fresh sandbox that you're willing to throw away. As long as you don't commit and push anything, there will be no impact outside the sandbox.
– joanis
Jan 19 at 17:16
add a comment |
1
Your approach is a bit more involved than what I would've proposed: just unpack the zip inside the local repos, overwriting all the files. Then,git diff
will tell you which files in the working tree have changes compared tomaster
and you can still commit them. Also, no manual copying of.gitignore
. Haven't tried it but that should do the trick, no?
– Jonas
Jan 19 at 14:32
I added some additional information to the question. Your suggestion would have worked under normal circumstance, I think.
– Zeth
Jan 19 at 15:00
Even with your addition1, I think @Jonas is right: setup everything using agit clone
and whatever else your development tool sets up, then overwrite the local files with the contents of the zip andgit diff
etc will work. If you're worried about messing things up, do it all in a fresh sandbox that you're willing to throw away. As long as you don't commit and push anything, there will be no impact outside the sandbox.
– joanis
Jan 19 at 17:16
1
1
Your approach is a bit more involved than what I would've proposed: just unpack the zip inside the local repos, overwriting all the files. Then,
git diff
will tell you which files in the working tree have changes compared to master
and you can still commit them. Also, no manual copying of .gitignore
. Haven't tried it but that should do the trick, no?– Jonas
Jan 19 at 14:32
Your approach is a bit more involved than what I would've proposed: just unpack the zip inside the local repos, overwriting all the files. Then,
git diff
will tell you which files in the working tree have changes compared to master
and you can still commit them. Also, no manual copying of .gitignore
. Haven't tried it but that should do the trick, no?– Jonas
Jan 19 at 14:32
I added some additional information to the question. Your suggestion would have worked under normal circumstance, I think.
– Zeth
Jan 19 at 15:00
I added some additional information to the question. Your suggestion would have worked under normal circumstance, I think.
– Zeth
Jan 19 at 15:00
Even with your addition1, I think @Jonas is right: setup everything using a
git clone
and whatever else your development tool sets up, then overwrite the local files with the contents of the zip and git diff
etc will work. If you're worried about messing things up, do it all in a fresh sandbox that you're willing to throw away. As long as you don't commit and push anything, there will be no impact outside the sandbox.– joanis
Jan 19 at 17:16
Even with your addition1, I think @Jonas is right: setup everything using a
git clone
and whatever else your development tool sets up, then overwrite the local files with the contents of the zip and git diff
etc will work. If you're worried about messing things up, do it all in a fresh sandbox that you're willing to throw away. As long as you don't commit and push anything, there will be no impact outside the sandbox.– joanis
Jan 19 at 17:16
add a comment |
0
active
oldest
votes
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',
autoActivateHeartbeat: false,
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%2f54268042%2fcompare-files-between-production-files-and-repository%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
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%2f54268042%2fcompare-files-between-production-files-and-repository%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
1
Your approach is a bit more involved than what I would've proposed: just unpack the zip inside the local repos, overwriting all the files. Then,
git diff
will tell you which files in the working tree have changes compared tomaster
and you can still commit them. Also, no manual copying of.gitignore
. Haven't tried it but that should do the trick, no?– Jonas
Jan 19 at 14:32
I added some additional information to the question. Your suggestion would have worked under normal circumstance, I think.
– Zeth
Jan 19 at 15:00
Even with your addition1, I think @Jonas is right: setup everything using a
git clone
and whatever else your development tool sets up, then overwrite the local files with the contents of the zip andgit diff
etc will work. If you're worried about messing things up, do it all in a fresh sandbox that you're willing to throw away. As long as you don't commit and push anything, there will be no impact outside the sandbox.– joanis
Jan 19 at 17:16