small medium large xlarge

Dmfcb_pragsmall
02 Nov 2010, 00:17
David Copeland (477 posts)

After doing the following:

> markdown intro.md > intro.md

and nearly having a heart-attack, I put my writing under git (of course, I had to change my markdown’ed @intro.md@ HTML back into Markdown first :).

I prefer generally to put this stuff up on GitHub, but I don’t have a paid account, so it can’t be private. Will putting up my WIP in a public github repo hurt my chances of publishing my material later?

Travis-tiy-sq_pragsmall
02 Nov 2010, 00:35
Travis Swicegood (117 posts)

I’m not a publisher, so take this with that grain of salt in mind…

There’s definitely the possibility. Most publishers want first rights to a book, so the fact that it’s available (even if in a rough form) for on GitHub might hurt your chances. Another possibility that gives you offsite backups and version control is to store you Git repository inside a Dropbox folder. Gives you a basic auto-backup without having to publish your work automatically.

-T

Generic-user-small
02 Nov 2010, 01:43
M. Edward (Ed) Borasky (8 posts)

I’ve got a paid Github account. I think the basic one is $7.50 a month, which is cheaper than Dropbox or SpiderOak. I have a free SpiderOak account but I’m so used to Github that I don’t think I could get used to a new workflow.

Bphogan2016_pragsmall
03 Nov 2010, 14:28
Brian P. Hogan (178 posts)

One of our books (Rails Test Prescriptions) started out as a self-published title. So having your text out there publicly probably won’t really hurt too much. Besides, if you work with a publisher, the book will change shape.

Version control is a must, but if you’re a cheapskate there are a few options:

First

git init --bare

is really handy. You can do that on your web server, or even on a folder on your computer. I keep mine in my dropbox.

I’m on a Mac, so my dropbox folder is in ~/Dropbox….

mkdir -p ~/Dropbox/git/mybook.git
cd ~/Dropbox/git/mybook.git
git init --bare
cd ~/books/mybook
git init
git add *
git commit -m "My first chapter, ready to go into version control"
git remote add origin ~/Dropbox/git/mybook.git
git push origin master

Your remote could also just be username@yourwebhost:yourbook.git if you did the git init –bar out on a host or a VPS. Git can use SSH to push files.

So you have lots of options. Plus you can just back up your folder with rsync somewhere too, since git is just a bunch of files.

Hope that helps!

Dmfcb_pragsmall
03 Nov 2010, 16:32
David Copeland (477 posts)

I ended up with your option 2 (putting it on my remote webhost). Added a post-commit hook to push it on every commit, too

New_clothes_tilley_hat_v1_pragsmall
04 Nov 2010, 20:58
Bob Cochran (170 posts)

Brian, can you explain how to follow through and put my drafts in git after creating the git repository? I’m not well versed in git. What incantations do I need to update a subsequent revision of the documents in ~/books/mybook?

Bphogan2016_pragsmall
04 Nov 2010, 21:36
Brian P. Hogan (178 posts)

@Bob Cochran:

Really simple workflow from start to finish:

mkdir -p ~/Dropbox/git/mybook.git
cd ~/Dropbox/git/mybook.git
git init --bare
cd ~/books/mybook
git init
vim awesomechapter.txt
....  # you did some work and saved it
git add *
git commit -m "My first chapter, ready to go into version control" 
git remote add origin ~/Dropbox/git/mybook.git
git push origin master

vim awesomechapter.txt   # make changes / edits
....  # you did some work and saved it

git status   # see what's changed. It says your awesomechapter.txt is modified

git add awesomechapter.txt  #yes you added it before but git needs you to add it to THIS snapshot
git commit -m "awesome chapter changes"

However, if you haven’t added any NEW files Git needs to track, you can commit new versions of any files you’ve previously committed with one line instead of two:

git commit -a -m "awesome chapter changes"

That’s my preferred mode, but sometimes I only want to commit one file of the three I’ve got in progress, and that’s why I like Git.

So if you add a new file, remember to

git add path/to/file

Then you can commit it. Think of Git taking snapshots of your folder, and only of what you tell it to include. Then you’ll be ok.

Then you can push to your remote like before.

git push origin master

Hope that helps!

Generic-user-small
04 Nov 2010, 22:10
Daniel de Kok (38 posts)

Another nice thing is that for files that were added previously, you can selectively add content for the next commit:

git add -p
[make a selection]
git commit

Often, when you are working on multiple things, you want to commit distinct parts separately. git add -p allows you to do this.

New_clothes_tilley_hat_v1_pragsmall
04 Nov 2010, 22:20
Bob Cochran (170 posts)

Thank you very much, Brian. I followed your instructions in the first posting and have a git repository set up now for my book. Now I’ll do some writing and follow your instructions for committing new versions.

New_clothes_tilley_hat_v1_pragsmall
04 Nov 2010, 22:22
Bob Cochran (170 posts)

@Daniel de Kok:

Thank you very much, Daniel. I’ll put your tip to good use.

Dmfcb_pragsmall
05 Nov 2010, 00:32
David Copeland (477 posts)

If you are using OS X, I highly recommend GitX (download from http://gitx.frim.nl/ )

I typically run that, and pick files/snippets from files to create logical commits

You must be logged in to comment