When we build our application, we fetch code from a directory of a CVS repository first then build it. So in Git, do we have anything similar to do it. I just want to checkout from a specfic diectory of Git repo and then build our code. No local repo maintainance, nothing. Just code checkout.
I know there is something called "Sparse checkout". Do we have anything simpler?
My problem is that this build script can be run on any server. So if I choose Sparse checkout, I will have to go on each server ,set-up Git and and tell it how to do sparse checkout.
Git philosophy is miles away from CVS, so I suggest you to act differently here. Your Git repositories will be distributed, every developper or server will have a copy of it, with one being authoritative among these (origin
remote in Git terms).
When you want to start a build from a fresh checkout, you first say Git to grab the latest changes from origin
, this is called a fetch.
git fetch origin
Then, to have a fresh checkout, you want your filesystem to be exactly the same as the server version, without any other file.
git checkout --force origin/master
git clean -d --force
The advantage here is that the network operation is very efficient, you grab only the latest diffs from the server you want to sync with, and you're still sure that you're building from the right files, without them being changed.
You'll want to check also tools for Continuous Integration, like Jenkins, which quite well integrated with Git repositories.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With