{"thread":{"id":"56250","subject":"Branch Management","startedAt":"2021-08-10T22:24:59Z","lastAt":"2021-08-11T06:32:05Z","messageCount":2,"participants":["mail.chris.az@gmail.com","Bagas Sanjaya"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"432422","messageId":"01d001d78e36$8d47f380$a7d7da80$@gmail.com","threadId":"56250","inReplyTo":null,"subject":"Branch Management","fromName":"","fromEmail":"mail.chris.az@gmail.com","sentAt":"2021-08-10T22:24:55Z","receivedAt":"2021-08-10T22:24:59Z","isPatch":false,"sender":{"key":"mail.chris.az@gmail.com","avatar":null},"body":"I have a private git repository (private.git) on a private server\n(PRIVATEREPO.COM).  That repo is updated via development on my local system.\nAll works great in that area.  I have 2 branches, \"master\" and \"version\".\n\nI want to update my production system via git from the private git\nrepository via command line.  The production system not only contains the\nfiles from the repo, but also additional files and directories.  I need\nthose files to be left alone.\n\nI was able to successful clone just the \"master\" branch using:\n\n# git clone -b master git_user@PRIVATEREPO.COM:private.git production.git\n\nI am now ready to move the new \"version\" branch.  \n1.  How can I do that?\n\nThe \"version\" branch contains some new files that are not in the \"master\"\nbranch.\n\nNow suppose that I move to the \"version\" branch, but determine that I need\nto go back to the \"master\" branch.\n\n2.  How do I go back to the \"master\" branch and remove any of the new files\nthat were uploaded from the \"version\" branch?  I don't want any remnants\nthat the \"version\" branch was even there.\n\nHopefully someone can head me in the right direction.\n\nThanks!\n\n"},{"id":"432450","messageId":"4b533ee7-4aa7-6ad5-6722-fca3eaadf464@gmail.com","threadId":"56250","inReplyTo":"01d001d78e36$8d47f380$a7d7da80$@gmail.com","subject":"Re: Branch Management","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2021-08-11T06:31:52Z","receivedAt":"2021-08-11T06:32:05Z","isPatch":false,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"On 11/08/21 05.24, mail.chris.az@gmail.com wrote:\n> I have a private git repository (private.git) on a private server\n> (PRIVATEREPO.COM).  That repo is updated via development on my local system.\n> All works great in that area.  I have 2 branches, \"master\" and \"version\".\n> \n> I want to update my production system via git from the private git\n> repository via command line.  The production system not only contains the\n> files from the repo, but also additional files and directories.  I need\n> those files to be left alone.\n> \n\nYou can specify which files and directories you want to ignore in \n.gitignore. For example, based on your use case:\n\n```\n/var/prod/\n/etc/ohmyapp/ohmyapp.conf\n...\n```\n\n> I was able to successful clone just the \"master\" branch using:\n> \n> # git clone -b master git_user@PRIVATEREPO.COM:private.git production.git\n> \n> I am now ready to move the new \"version\" branch.\n> 1.  How can I do that?\n> \n\nUse `git checkout version`.\n\n> The \"version\" branch contains some new files that are not in the \"master\"\n> branch.\n> \n> Now suppose that I move to the \"version\" branch, but determine that I need\n> to go back to the \"master\" branch.\n> \n> 2.  How do I go back to the \"master\" branch and remove any of the new files\n> that were uploaded from the \"version\" branch?  I don't want any remnants\n> that the \"version\" branch was even there.\n> \n\nPractically speaking, `git checkout` updates working directory to \nrevision specified in the argument, ignoring `.gitignore`.\n\nI assumed that you have app+default config committed to your repo (not \nincluding /var-like production data of course). In that case, a simple \n`git checkout` will do most of the job; you need to figure out how to \nhandle .gitignore-ed trees (since these maybe version-specific).\n\n-- \nAn old man doll... just what I always wanted! - Clara\n"}]}