0

I am currently learning how to use git and already became friends with this beautiful tool. Right now, I am converting all my "normal" projects to local git projects, including establishing a branching model I found and consider useful. In this model, the master branch is only used for production releases and the development is done mainly in a development branch (see http://nvie.com/posts/a-successful-git-branching-model/)

My git repositories and my working directory are in

/data/projects/working/{PROJECT}/

I need to deliver every finished release to my customers, so it would be extremly convenient to have a delivery-ready version of my code being prepared automatically everytime a branch is merged to the master-branch of my project (which is equivalent to releasing a production-ready version). In praxis, this means, that, after a merge to "master", all the files in the master branch (except for the .git-directory), should be copied to

/data/projects/release/{PROJECT}/

after wiping the contents of that folder. I allready came along the git hooks, escpecially the post-merge hook. What I couldn't figure out is how to professionally get the raw contents (no git-files) from the master-branch and copy them to a given directory without it being a git repository itself. Simply copying the work-directories contents doesn't seem very failproof to me.

Looking forward to your support and thanks in advance! Greetings, Jonathan

Jonathan Weber
  • 474
  • 3
  • 17
  • I don't understand why you want to copy anything to another directory. Everything you need is in the git repo – Tim Sep 12 '15 at 12:51
  • First use case: You want to be able to quickly give the customer the files he or she needs. Just take the project folder from /release and be sure that it is the latest, working production release without any git files or folders. Second use case: You want to use the production release on your local machine (Wordpress plugin, for example). If you dynamically link to the working directory, the plugin stops functioning when you switch to a not-yet-functional development branch. So being able to link to the /release folder and allways have the latest production-release in it would be useful. – Jonathan Weber Sep 12 '15 at 13:05

2 Answers2

0

GIT repository generate unique number of each commit...master branch is production branch which have latest code...we drop a branch from master using git checkout -b after that we do work in it.

There is no possible in git to get raw content without adding file in git...one thing if you add new files in project it will remain in your directory until you didn't add them in git repo.

0

git archive is the way to go, I found the solution myself in another thread on stackoverflow.

See here: https://stackoverflow.com/a/2867314/5230714

Community
  • 1
  • 1
Jonathan Weber
  • 474
  • 3
  • 17