2

I know bits and pieces of PHP and JavaScript (besides HTML & CSS) — just enough to fork existing plugins for scripts like blogs (Wordpress), forums (Vanilla Forums), etc. And I am a Windows user.

I want to understand / learn Git so that I can use GitHub, or any other service like that effectively. So, what are the pre-requisites for learning Git?

(PS: I am asking this because it looks like Git requires some Linux knowledge, alongside some BASH and SSH.)

its_me
  • 10,998
  • 25
  • 82
  • 130

7 Answers7

4

I use Git on both Linux and Windows. Under both of those environments, I use its command-line interface exclusively. When installing on Windows you have the option to install it such that it will only work under a bash shell that runs in a window of its own, or to have the commands also exported into the standard Windows console environment as well. When I use it on my windows platform I use both the bash console it installs and the windows console; whichever happens to be more convenient at the moment.

Git doesn't require much Linux knowledge, except that some commands are sort of Linuxy (my own word) in their nature. For example, "git rm filename" to remove a file from both your system and from the repository. 'rm' is the Linux version of what Windows/DOS would call 'del'. So there are a few of these sorts of idioms you'll have to get used to. But they don't really contribute much to the overall learning curve.

I saw that someone mentioned that nobody knows all of Git by heart. That's probably true. But within a few days of getting started with it, you'll find yourself able to do most of the 'everyday' stuff without reading documentation. And when you get to one of those less commonly used commands, or when you need some command switch that is difficult to remember the documentation is only a few keystrokes away.

There is a book available free online: Pro Git. It's great. Well worth the time investment to read it. I also happen to like Version Control with Git (O'Reilly&Assoc). If you really want to learn Git inside and out, read those two books in that order. Additionally, every git command has a help page associated with it that you access by appending --help to the command. Example: git checkout --help will bring up the help page for that command.

If you're serious about programming nowadays, version control is a tool you can ill-afford to ignore. Git is the current coolest kid in the school. You'll be glad you invested the time in learning to use it.

DavidO
  • 13,812
  • 3
  • 38
  • 66
  • Thanks for the excellent & explanative answer. I am really glad that I got some good advise here. – its_me Mar 15 '12 at 08:53
3

Check this tutorial out to learn the basics. And don't be afraid of bash, Linux or anything. Yes, you will have to use console, but it's not scary at all. At first, you won't need much besides the cd, ls, mkdir, rm and of course git commands.

Install git for Windows from here: http://code.google.com/p/msysgit/

And don't use GUI (Tortoise) for a while, to get used to console. Later you might want to use it for logs, diffs or something, but first you better understand what's behind all those fancy menus and buttons.

dmedvinsky
  • 8,046
  • 3
  • 31
  • 25
2

When you try to use git, I can recommend to you to see it's documentation page. If you want to start quickly, you can start with Everyday git (in 20 commands) - you will learn so call 'normal' using git. I've read book Pro Git, which is very good for beginners too. Or you can try to learn git in the official Git tutorial. Everything is available from this page.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Jan Marek
  • 10,390
  • 3
  • 21
  • 19
1

Git can be installed on windows, but what I usually see windows guys do is use it via a GUI. that's usually a bad idea, git really feels much more at home with a console. I use a GUI only for diffs.

So for the basic stuff no bash/linux knowledge is needed, but being able to "tolerate" a console (I know why windows guys hate it so much - the default console sucks. IIRC there's a much more advanced shell to be downloaded from Microsoft) will make it much smoother.

Other than that, just reading a git tutorial and playing with git a bit will be enough. It's really not rocket science, and if you just learn the few basic concepts needed (push/pull, commit, add - first, and then checkout, merge, branch), and not try to memorize the entire command stack you'll be on your way in less than an hour. (no one knows it completely by heart, I doubt even Linus Torvalds)

Not_a_Golfer
  • 47,012
  • 14
  • 126
  • 92
  • You said `no one knows it completely by heart, I doubt even Linus Torvalds` - - so most developers have a list of commands that they frequently use in a text file or something of sorts? Even you? – its_me Mar 15 '12 at 07:37
  • You learn the basic stuff you need pretty quickly. At first I kept a cheat sheet on my desk (this one: https://github.com/AlexZeitler/gitcheatsheet/raw/master/gitcheatsheet.pdf) but after a few days I didn't need it anymore. And git is self documented. you just type `git help ` and you can read the full documentation of it, e.g. `git help merge` or `git merge --help` – Not_a_Golfer Mar 15 '12 at 07:49
  • I don't think it's a bad idea, especially for newcomers. I agree the command line is really powerful but newbies need more handholding than power at first. – inger Mar 15 '12 at 09:53
  • @inger the learning curve might be steeper, but you'll get things done more quickly and stop being a n00b much more quickly. In my work place, people who insist on GUI are still confused after months of work, but command line people just get things done. This is regardless of other skills. – Not_a_Golfer Mar 15 '12 at 10:26
  • @DvirVolk good point - but I think there is a healthy balance. Yes, they should be confident leaving the GUI as soon as they grow out of it. And, I don't consider myself a n00b anymore, still I found gitk more pleasant than plain log a times. The thing is, in general there are GUIs for dummies (which look cool but can be limiting soon) and more hybrid ones which can combine the underlying power with lower barrier to entry. I find the Git Guis to be in the the latter category. – inger Mar 15 '12 at 11:54
1
  • Check Manual
  • Forget formal logic and be ready to Linus-logic
  • Have minimal knowledge about bash and commands-set
  • Be ready to (some amount of, >1) data-loss during learning curve
  • Always have man-pages in one click away
Brian Webster
  • 30,033
  • 48
  • 152
  • 225
Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
1

First, Understand the important concepts of git, since it is different from centralized ones. Use GUI client tools (TortoiseGit, gitk, ...) to make it convenient to use. GUI clients are enough for daily operations.

Commands such as git add for some files (no regular pattern) is much more convenient in GUI then command line. For commit message, GUI allows copy and paste from other programs, but vi does not. You only need command line for low-level commands.

linquize
  • 19,828
  • 10
  • 59
  • 83
1

I don't see a problem using git gui or similar, especially for ramp up.

My colleagues all started with that and this way, I was able to work with them effectively in 10 minutes. I just had to tell them to use git pull and those 4 big buttons (Rescan, Stage, Commit, Push) + visualise(gitk from which diffs, checkout, reset, even cherry pick etc.. are), and maybe stash. Less to be forced to remember, the milder the learning curve - this might work better for some than starting with all the 10+ usual git commands and constantly reading the help.

And, while the UI is far from fancy, and could be slightly more usual - it's very functional - I happen to use it sometimes: eg for status and commit and push: just less typing (F5,Ctrl+Enter).

Once people are familiar with the basic workflow in an easy way like that, they still won't have the deeper understanding - which is required for the more confidence and satisfaction as well as the more powerful stuff.

At that point the best investment IMHO is to deep dive and concentrate on the underlying model. I found Git for computer scientists great for this.

Not much u*nix specifics so far.

Only after this I'd concentrate on nitty gritty of the commands. Especially windows: where as someone mentioned console actually sucks.

inger
  • 19,574
  • 9
  • 49
  • 54