Profile

Cover photo
Hasan Mahmud
AboutPosts

Stream

Hasan Mahmud

Shared publicly  - 
 
 
When should you version-control? Always.

I find it amusing how often in Stack Exchange and Quora the question comes up, when should I use version control? or at what point has a project gotten complex enough to use version control? or how many programmers are the maximum you can have without version control?, or endless variants.

I use Git for just about everything. Not just code and configuration files; documents I'm writing, my c.v., anything that's a) mostly text and b) that I change from time to time. There are (I just checked) over a hundred Git repos in my laptop's home directory—and that's all personal stuff only, no work stuff! My usual routine for writing a "throwaway" or "one-off" script is:

1. Create a directory in ~/src/scripts and cd into it;
2. echo '#!/path/to/scriptinglanguage' > scriptname && chmod 755 scriptname;
3. git init && git add scriptname && git commit -m 'Initial rev'

(Actually, I have a shell function that does all this for me; I just supply the scripting language I'm using and the script name.)

Doing this has three immediate advantages:

1) "One-off scripts" have the tendency to become much more than that without your noticing. This way, I'm prepared for that and can transition; I don't have to make a decision at some point to "get serious", with all the futzing about that requires when up till now it's just been a random file sitting in ~/bin;

2) Creating branches for each thing you're doing, and commits when you have runnable code, helps you to return to it later and remember what you were working on, and it forces you to be a bit more methodical (ever realized after much craziness and cursing that you were using two different flag-parsers in a single script, or something equally fuzzy-headed that a moment's clarity would have avoided?); and

3) My editor is setup to do "WIP¹ commits" every time I save (yours probably can do the same), so it's trivial for me to see what happened when suddenly something unexpected goes wrong. ("Oops, I just past-bombed the contents of that chicken recipe into the middle of that function... it was legal Perl, though....") re vms, ltns!²

Heck, I even create Git repos in /tmp (to return to yesterday's subject) all the time! Typically that's when I have something even more ephemeral than a one-off: a sandbox to test some language feature. By putting it in /tmp, I'm committing to myself, straight off, that this thing is going to get deleted very soon, and I won't care. If I put it in ~/src, OTOH, I'm going to stumble upon it again in a couple years and spend a head-scratchingly long time trying to figure out why the heck I was writing self-modifying reentrant methods that claim to have something to do with cattle. (My throwaway test programs are all animal-themed, you see....)

So put me in the category of people completely befuddled by those who ask whether they should version control a particular project. It's like your asking³ whether you should touch-type a particular program—more likely a sign that you aren't very confident with it rather than an actual question.

¹ Stands for: "Work In Progress".

² If you get that, color me impressed. If you get it and you're under 30, please explain to me how that's even possible.

³ No, automatic grammar checker, that should not be "you're asking". Go away.

#git   #versioncontrol   #softwaredevelopment  
8 comments on original post
1

Hasan Mahmud

Shared publicly  - 
 
Thank you for playing.
1

Hasan Mahmud

Shared publicly  - 
 
David Chalmers is a contemporary philosopher of mind, and proponent of panpsychism, the belief that there is some form of consciousness in everything. He believes that it is impossible to explain consciousness scientifically using only objective facts, so if science is to explain consciousness ...
1

Hasan Mahmud

Shared publicly  - 
 
Dipti's sketch of her and late dadi.
1

Hasan Mahmud

Shared publicly  - 
1

Hasan Mahmud

Shared publicly  - 
 
The only reason I'm sharing this is, well,  because of the name.
GoFuckYourSelf (GoFY for short), is a new operating system built using the Go programming language. Goals. To have lots of fun, and to piss off lots of people. Design Philosophy. Pick always the simplest and easiest solution. When in doubt, always use brute force, and when not in doubt, ...
1

Hasan Mahmud

Shared publicly  - 
 
April 19, 1965: Before Facebook, before Apple, and even before Intel, there was Fairchild Semiconductor. Launched in 1957 by the so-called "Traitorous Eight" -- who left Shockley Labs after the unh...
1

Hasan Mahmud

Shared publicly  - 
1

Hasan Mahmud

Shared publicly  - 
 
Rather than fighting they became allies.
Today on April 1st 2015, we'd like to announce that Popcorn Time has been acquired by Netflix for $11.5 million.
1

Hasan Mahmud

Shared publicly  - 
 
 
Join co-founders Christian Cotichini, Peter Diamandis and Emily Fowler for the official launch of HeroX, an open prize platform that empowers anyone to breakthrough challenges in their company, their community or the world.

Want to get started on a challenge before our launch event? Visit http://herox.com/welcome
This Hangout On Air is hosted by Hero X. The live video broadcast will begin soon.
Q&A
Preview
Live
HeroX Public Webcast
Fri, March 27, 2:30 PM
Hangouts On Air - Broadcast for free

36 comments on original post
1
Story
Tagline
Trying to figure who I am everyday
Links
Contributor to
Basic Information
Gender
Male
Looking for
Friends, Networking