Compare files between production-files and repository












0















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 with origin/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?




  1. Unpack zip-file.

  2. Enter it, and do git init.

  3. Make a new branch: git checkout -b myNewBranch.

  4. Add a .gitignore-file manually (from the origin/master-branch).

  5. Commit it: git commit -m 'Preping for changes'.

  6. Push it: git push origin myNewBranch.

  7. Pull all branches (get my master-branch locally): git pull -a

  8. Change to master-branch: git checkout master

  9. Merge the two, and allow unrelated histories: git merge myNewBranch --allow-unrelated-histories.

  10. Resolve the potential merge-conflict.

  11. 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.










share|improve this question




















  • 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











  • 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
















0















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 with origin/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?




  1. Unpack zip-file.

  2. Enter it, and do git init.

  3. Make a new branch: git checkout -b myNewBranch.

  4. Add a .gitignore-file manually (from the origin/master-branch).

  5. Commit it: git commit -m 'Preping for changes'.

  6. Push it: git push origin myNewBranch.

  7. Pull all branches (get my master-branch locally): git pull -a

  8. Change to master-branch: git checkout master

  9. Merge the two, and allow unrelated histories: git merge myNewBranch --allow-unrelated-histories.

  10. Resolve the potential merge-conflict.

  11. 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.










share|improve this question




















  • 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











  • 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














0












0








0








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 with origin/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?




  1. Unpack zip-file.

  2. Enter it, and do git init.

  3. Make a new branch: git checkout -b myNewBranch.

  4. Add a .gitignore-file manually (from the origin/master-branch).

  5. Commit it: git commit -m 'Preping for changes'.

  6. Push it: git push origin myNewBranch.

  7. Pull all branches (get my master-branch locally): git pull -a

  8. Change to master-branch: git checkout master

  9. Merge the two, and allow unrelated histories: git merge myNewBranch --allow-unrelated-histories.

  10. Resolve the potential merge-conflict.

  11. 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.










share|improve this question
















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 with origin/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?




  1. Unpack zip-file.

  2. Enter it, and do git init.

  3. Make a new branch: git checkout -b myNewBranch.

  4. Add a .gitignore-file manually (from the origin/master-branch).

  5. Commit it: git commit -m 'Preping for changes'.

  6. Push it: git push origin myNewBranch.

  7. Pull all branches (get my master-branch locally): git pull -a

  8. Change to master-branch: git checkout master

  9. Merge the two, and allow unrelated histories: git merge myNewBranch --allow-unrelated-histories.

  10. Resolve the potential merge-conflict.

  11. 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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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











  • 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














  • 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











  • 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








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












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
});


}
});














draft saved

draft discarded


















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
















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Liquibase includeAll doesn't find base path

How to use setInterval in EJS file?

Petrus Granier-Deferre