Download Git Magic

Transcript
Chapter 2. Basic Tricks
2.5. Instant Publishing
Suppose you’ve written a script you’d like to share with others. You could just tell them to download
from your computer, but if they do so while you’re improving the script or making experimental changes,
they could wind up in trouble. Of course, this is why release cycles exist. Developers may work on a
project frequently, but they only make the code available when they feel it is presentable.
To do this with Git, in the directory where your script resides:
$ git init
$ git add .
$ git commit -m "First release"
Then tell your users to run:
$ git clone your.computer:/path/to/script
to download your script. This assumes they have ssh access. If not, run git daemon and tell your users to
instead run:
$ git clone git://your.computer/path/to/script
From now on, every time your script is ready for release, execute:
$ git commit -a -m "Next release"
and your users can upgrade their version by changing to the directory containing your script and typing:
$ git pull
Your users will never end up with a version of your script you don’t want them to see. Obviously this
trick works for anything, not just scripts.
2.6. What Have I Done?
Find out what changes you’ve made since the last commit with:
$ git diff
Or since yesterday:
$ git diff "@{yesterday}"
7