50
$\begingroup$

I like Git, or at least the idea of it. However I can not get my head around how to use it. Therefore I would not like to teach it.

(This question is about learning to use Git. Not about comparing it to other revision control systems.)

I have used a range of revision control systems: SCCS, ClearCase, RCS, CVS, and Subversion. I then tried to learn Git. In reading the manuals I got a full understanding of its internals. I even managed to use it, but after a few days I would forget how to use it. The interface seems unintuitive. I then adopted Mercurial (hg) — a similar, but easier to use revision control tool.

I have noticed that Git is very popular, and maybe superior to Mercurial (internally, if not from a usability point of view). And am therefore thinking of giving it another go.

What can I do to make this journey easier for me?

What good user interfaces should I adopt?

I am not interested in proprietary tools; All tools should be Free Software / Open Source. They need to be available for GNU/Linux and Microsoft Windows (I have to use the latter at work).


Who are the learners?

  • Myself (a software engineer > 20 years experience of revision control systems).
  • My pupils (age 11 to 18), if I find it easy enough to learn my self.

My preference for user interfaces are

  • Unix (GNU/Linux) command line.
  • Unix (GNU/Linux) GUI.
  • Microsoft's Windows GUI.
  • Microsoft's command line.

So it is important, for me, to have a good command line tool, on my GNU/Linux machine. And important to have a good, and the same, GUI on GNU/Linux and Microsoft Windows.

My goals

  • To use the tool to store the history of my, and pupils, projects.
  • To be able to look at past history.
  • To be able to revert to past state.
  • To merge and resolve conflicts.
  • To never think, that live would be easier without it.

enter image description here

I am not against command-line usage (it is my favourite way to use the computer), I am against cryptic, hard to remember commands, that have surprising results.

$\endgroup$

19 Answers 19

43
$\begingroup$

I highly recommend this tutorial: http://learngitbranching.js.org/

It uses a visual representation of the internal state combined with actual commands in a sandbox environment along with a step by step walk-through that I found really helpful in wrapping my head around what each command actually did when I was new to Git.

$\endgroup$
  • 10
    $\begingroup$ I second this resource. I think it's miles above in quality compared to any other git tutorial. Other tutorials take a cookbook-like approach and teach git commands as a series of things to be memorized, or talk about git model in a fairly abstract and hard-to-grasp way. This tutorial does focus on git's underlying model, and does a great job of helping you see what's inherently possible and not possible with git (even if you might not remember the exact commands to do something). $\endgroup$ – Michael0x2a Jul 24 '17 at 18:17
  • $\begingroup$ I will check out this tutorial. Thanks! Also, welcome to Computer Science Educators! I hope we hear more from you in the future. $\endgroup$ – Ben I. Jul 24 '17 at 18:45
  • $\begingroup$ I fortunately stumpled upon this Q on the hot network questions tab. I was looking for an easy to understand Tutorial the other day, and just clicked trough it. I Went from being hopelessly confused to actually understanding most of the stuff behind the scenes over the course of two hours. And it was even fun! Absolutely brilliant! $\endgroup$ – antipattern Jul 25 '17 at 10:44
  • 1
    $\begingroup$ +1, I found that tutorial to be helpful. But it makes you operate on artificial commits. Ungit[1] displays a similar graph of commits, but is a regular Git frontend. Your students can use it for their assignments. If you insist on teaching them CLI first, they can use Ungit to visualize the results of their CLI commands. [1] github.com/FredrikNoren/ungit $\endgroup$ – user31389 Jul 25 '17 at 12:20
14
$\begingroup$

First, realize that you can't learn everything about Git all at once. Learn the basics to get you going. Learn the other commands as needed. Practice a lot. Git is awesome.

I suggest that you learn Git from the terminal. That will build an appreciation for the IDE plugins and GUIs later. Plus, it's helpful to understand what's going on under the hood. Here is a good interactive Git tutorial. Here's another, more comprehensive one.

Windows

You can download a Git client for Windows here: https://git-scm.com/ . This will give you a light bash terminal that you're already familiar with.

Mac

Try a Git command from a Mac terminal. It will prompt you to install Git (if needed).

Gnu/Linux

A lot of distros come with git. To install on any Debian based system, such as Ubuntu type sudo apt-get install git.

What's really going on?

This is a great video on what's really going on in Git. I highly recommend it: https://maryrosecook.com/blog/post/git-from-the-inside-out-talk

Connecting to GitHub, Bitbucket, etc.

Soon, you'll want to connect your computer to a Git server. These instructions will help you create a local, public SSH key that you can paste into your GitHub, Bitbucket accounts. This will give you access to your remote repos. By the way, you can create free accounts at GitHub, Bitbucket, or GitLab.

$\endgroup$
  • 3
    $\begingroup$ Nice answer. OP, notice that a "git server" is just another remote to git. This means, for example, that you can use remotes also for local backups, et cetera. $\endgroup$ – Tobia Tesan Jul 24 '17 at 16:49
  • 2
    $\begingroup$ I like this answer a lot too. I spent a -long- time just doing git commit/push on my own private repositories. It was just nice to have backup files. Eventually you say "oh, wouldn't it be nice if Git did that" and you will probably 1) find how on stackoverflow and 2) see how many others viewed or upvoted canonical questions. $\endgroup$ – user2206 Jul 24 '17 at 22:11
11
$\begingroup$

If you already use an IDE, this could be the right way for you:

Git support in your IDE

Many IDEs come bundled with Git support. Eclipse, for example, uses EGit for Git integration. The JetBrains IDEs also provide Git support. The text editor Atom can be extended with plugins (e.g. Git+) to provide Git support.

All of those IDEs run on most common platforms (e.g. Linux, Mac, Windows) and look more or less the same there. This would mean you can use the Git client you know at home and at work if you use the same IDE at both places.

Normally, the Git support integrates quite well with the programming workflow. The Git clients are often quite mighty, but always accessible using a comfortable GUI, which could help as there are no terminal commands to memorize. However, you should keep the Git concepts in mind - depending on the IDE, the built-in Git client will follow those concepts more or less closely.


I personally use the built-in Git integration of various IDEs in my day-to-day work and am very happy with it, so I could recommend it to everyone who doesn't want to experiment but just wants to have a good-working Git client.

$\endgroup$
  • 1
    $\begingroup$ The only thing I'd add to this is would be that command line is almost imperative for most things above basic usage. For example, git stash [pop] and git reset HEAD~[n] (Note: these can be very dangerous if not used properly. Beware) are things that I've found extremely useful, but have yet to find in any plugin/IDE. Whether that's my inability to find the functionality, or the plugin not having it, I don't know, but the OP seemed to express interest in more comprehensive functionality. $\endgroup$ – Daevin Jul 24 '17 at 16:17
  • 1
    $\begingroup$ @Daevin This is a good point. I know that at least the JetBrains IDEs usually provide access to a terminal, so you could type those commands there. -- As a sidenote: I think EGit even has the commands you're talking about as a built-in: Stashing should be possible with "Team > Stashes > ...", resetting using "Replace with > ...". But I nevertheless get your point ;) $\endgroup$ – TuringTux Jul 24 '17 at 16:47
  • 1
    $\begingroup$ ah, gotcha. Most of my experience comes from the Visual Studio plugin for Git, Visual Studio's Team Explorer, and the GitHub desktop client, which are quite limited in their implementation of commands. I've used JetBrains' and Android Studio's git integration, though it was a couple years ago, and I found it to be lacking as well. But, as you said, most of these have the ability to open the command line to your local repo, so I guess the point is moot, as long as you know the commands :P $\endgroup$ – Daevin Jul 24 '17 at 18:41
  • $\begingroup$ Visual Studio 2017 also has Git integration called the "Team Explorer" and is very easy to use, particularly with hard resets (which I have used incorrectly far too many times x_x). $\endgroup$ – kem Jul 24 '17 at 22:28
  • 1
    $\begingroup$ @Daevin Just so you know, IntelliJ IDEs support stash [pop], reset HEAD~[n] (via selecting it in the log), and even interactive rebase as part of their in-IDE Git integration. The only time I go to the command line anymore is for less-well-written build tools that need to be run in a subdirectory of my project. $\endgroup$ – CAD97 Jul 25 '17 at 8:19
9
$\begingroup$

1) Use the built-in Git GUI

Git actually includes a built-in user interface known as git-gui which is great for novices learning Git for the first time. It's fairly simple to use, comes standard with Git, and is available on Windows, Mac OS X, and Gnu/Linux.

Git-gui has a very simple interface that visually displays the process of staging files, creating commits, viewing project history, amending the last commit, creating branches, local merging, fetching/pushing to remote repositories. It also includes easy access to Git Bash in your command line of choice for more advanced commands or, more commonly, manually correcting any errors that may occur. (And let's be honest, that happens a lot when using Git)

What I like most about Git GUI is that, since it comes as a built-in feature of Git, it doesn't make any attempts to oversimplify or obfuscate the process. Each action can be easily understood as a standard git command.

Download Git for Windows/Mac/Linux/Solaris

Git Gui screenshot

2) Contribute to an existing project

I first learned Git because I wanted to contribute to the Dolphin Emulator. It was a program I used very often to play my favorite games, and was something I wanted to see actively grow. I ended up joining the project's IRC chat room, which was filled with friendly developers willing to lend me a helping hand.

Having a project backed backed by a group of passionate developers really helped me contribute and learn, because I had a well-managed project which set my standards high not just for Git, but for how any team-project should be organized.

In short, find a project you are passionate about on GitHub, setup the code to run locally on your own PC, and don't be afraid to ask for help on any issues that come up along the way.

No contribution is too small, even if it's just changing the wording for a single menu option.

$\endgroup$
  • 1
    $\begingroup$ Seconding Git GUI and in particular gitk (under repository->visualize all branch history) for visualizing the current state of affairs. $\endgroup$ – Sumyrda Jul 25 '17 at 13:30
  • $\begingroup$ Upvoted. Even if you generally prefer command-line once you know what you are doing (as all True Developers should), the GUI is great for learning the capabilities and expected workflow of the system. This is precisely how I learned, with the exception that instead of #2 I used it on a small project of my own to get my feet under me. That also meant I wasn't screwing up anybody else when I made the first few inevitable noob mistakes. Of course using someone else's IDE (as suggested in another answer) is not as helpful because those weren't designed around Git like Git GUI was. $\endgroup$ – T.E.D. Jul 25 '17 at 14:34
6
$\begingroup$

It probably won't fit particulary good for you, as you want the same GUI on every platform, but I want to suggest GitHub Desktop for future readers, who don't have the platform requirement.

GitHub Desktop

GitHub Desktop (source code available on GitHub) is a graphical Git client by GitHub, available for Mac and Windows. It's especially designed to integrate with the hoster GitHub, but should also work with other Git hosters.

I think it's intuitive to use the version-control features of GitHub Desktop, which could be an advantage in your case, as this helps against forgetting commands.

It, however, does not follow the concepts of Git closely - so you will encounter some things that may be intuitive in GitHub Desktop, but appear strange to Git users who know e.g. the command line interface. As Steven Vascellaro points out in his comment, this could be a major downside when wanting to learn Git:

I'm hesitant to recommend GitHub Desktop to a new user trying to learn Git. Similar to using BlueJ for Java, it can be very difficult to transition to a different client after getting used to GitHub Desktop. It obfuscates many important parts of the traditional Git workflow.


I would therefore recommend GitHub Desktop to Windows users that want an easy and intuitive way to manage Git (e.g. because they have to use it inside their company) without having to deal much with the sometimes counter-intuitive (looking) concepts of Git.

$\endgroup$
  • $\begingroup$ gitkraken is a great cross platform graphical git GUI which I can recommend. $\endgroup$ – Daniel Vestøl Jul 24 '17 at 17:23
  • 4
    $\begingroup$ Does a GUI make git easy to learn, or just easier to use? Most of the developers I've worked with who used a GUI for git still didn't really understand git. They just knew where to click to make something happen, and if anything went wrong, they were lost. $\endgroup$ – Wayne Conrad Jul 24 '17 at 19:06
  • 1
    $\begingroup$ @WayneConrad Depends on the GUI, I think. For GitHub Desktop, I'd say it probably just makes it easier to use, however, it at least helps against forgetting commands. Other answers here provide GUIs that are better for learning, I think. $\endgroup$ – TuringTux Jul 24 '17 at 19:08
  • 4
    $\begingroup$ I'm hesitant to recommend GitHub Desktop to a new user trying to learn Git. Similar to using BlueJ for Java, it can be very difficult to transition to a different client after getting used to GitHub Desktop. It obfuscates many important parts of the traditional Git workflow. $\endgroup$ – Steven M. Vascellaro Jul 24 '17 at 20:31
  • 1
    $\begingroup$ @StevenVascellaro Good point - you pointed out something I'd had partially in mind when writing the answer but couldn't really express well. If you want to, you could edit in a paragraph with the contents of your comment. $\endgroup$ – TuringTux Jul 25 '17 at 5:51
5
$\begingroup$

Oh, you're almost exactly like I was about a year ago. I understood simple version control, and had a good handle on mercurial (thanks to http://hginit.com/). I had even convinced my then company and manager to switch from CVS to mercurial, so handling a DVCS wasn't really the issue. But for whatever reason I could not wrap my head around git. And then I wound up at another position where I was in the role of agitating for an improved version control system, and git was the only other option and I had to learn. And the absolute best resource I found for understanding git at a conceptual level was Git for Ages 4 and Up a roughly 1 and a half hour video that used tinker toys to explain git. That video was what finally started making things click for me. From there playing around in the command line and poking through some of the tutorials others have linked made a lot more sense.

If you have a good understanding of how a linked list data structure works at a low level, I found it helps to think of a git repository like a big linked list of your code at various states. And branches, tags and all the other stuff that goes with it are pointers to those states in the list. Using git is all about manipulating those pointers. But watch that video, it's probably the best "intro to how git works" I've ever come across and doesn't delve too deep into any specifics of the implementation at the time, so even though it's a few years old now, it's still plenty relevant. Lastly, I would recommend if you're already comfortable with the command line that you use the command line while you're learning, and only use GUI tools to show you a visual state of the repository. Understanding the individual commands makes some of the abstractions that the GUI tools use less confusing.

$\endgroup$
  • 1
    $\begingroup$ Welcome to Computer Science Educators! This is a very good answer. I hope we'll be seeing more answers and questions from you. $\endgroup$ – ItamarG3 Jul 25 '17 at 13:05
  • $\begingroup$ I just watched the video. I realised that it is not just me. The internals are easy, the interface is not. I also learnt that git now gives useful help messages (it would be better if it was easier to use, but this is a start). I will probably stick with mercurial for now (though mercurial does not handle renames, efficiently). $\endgroup$ – ctrl-alt-delor Jul 26 '17 at 12:21
  • $\begingroup$ @richard, yeah the git interface can be difficult from time to time, but it's worth learning. Having used mercurial for the past few years, and having spent the last year or so getting deeply familiar with git, I'm finally beginning to understand all the hubub. Mercurial is a fine tool and I still use it, it gives almost all the benefits of using git while being a simpler model to understand and there's enough plugins I bet it can replicate 98% of the git feature set. But once I got the git model, it started to feel much more natural as a developer, and I've started moving to git exclusively $\endgroup$ – moneyt Jul 26 '17 at 14:46
5
$\begingroup$

I have students follow through the Learn Enough Git to Be Dangerous tutorial, which goes through the basics of setting up a repo, committing, pushing to GitHub, and some simple collaboration.

Git is complicated; my students are usually pretty mystified by it at first. But the nice thing about it, is that once you've learned the basics, you can do things like pushing code to GitHub to share/backup, and it's already a useful tool.

$\endgroup$
4
$\begingroup$

Help students make improvements to a toy website with git & Github

I have taught git and Github basics with this activity from OpenHatch. It was successful for helping students learn git basics: clone, add, commit, push, and pull, as well as Github basics: making an account and repo, submitting an issue, and making a pull request.

In the activity, small groups work to improve a small website housed in a Github repo. The site is also hosted on Github, so they can see changes immediately. Issues are available in the repo for students to claim and then work on. Students really see the difference between running the site locally and seeing the version hosted on Github.

It requires some setup before hand, since students interface with a real Github repo. But it's worth it, since students get to use git in a realistic way (and so they have contextualized knowledge!). Another bonus is that no specific programming language is required, since students can modify text in HTML to complete tasks, or hack some javascript for the most advanced tasks.

$\endgroup$
4
$\begingroup$

I remember initially struggling with Git.

My main problem (and I'm sure I'm not the only one) was not understanding what the various operations actually did to the DAG, blindly typing obscure commands instead.

I believe that if you think in terms of the DAG, you will be able to master git very quickly, and even make sense of some apparently unintuitive behaviour [*].

I believe that any tools that help think in terms of the DAG would be helpful -- but I don't know firsthand of any GUI that really shines at this.

FallenNode's answer gives you the gem that is LearnGitBranching, which serves this very purpose. I can't recommend it enough.

I'll go against other answers and suggest that the command line is good enough for a beginner, if you take the time to understand what the commands do.

git-cola is a super lightweight GUI, free as in speech, almost certainly shipped by your distro, that you might find useful.

Useful resources:


[*] I'll give just one such example:

git cherry-pick nameofsomebranch

"But", you say, "I thought that you could cherry-pick commits, not branches." Why this works (and what it does!) is left as an exercise ;)

$\endgroup$
  • $\begingroup$ While I won't argue that git isn't unintuitive at times, cherry-pick branchname isn't really one of them IMO. This is actually something I discovered neither by accident nor search, but by reasoning: “so I want to CP the last commit from branch B. Hm, I could parse out the commit ID, wait, how do you do that again? Oh never mind, I'll just git log B and copy&paste that commit ID... but wait, what if I simply write git cherry-pick B in one command?” $\endgroup$ – leftaroundabout Jul 24 '17 at 21:24
  • $\begingroup$ I would say that the interface to git isn't unintuitive sometimes, but I want it to not be unintuitive all of the time. $\endgroup$ – ctrl-alt-delor Jul 24 '17 at 21:29
  • 2
    $\begingroup$ When I was first learning it seemed like everything was DAG-this and DAG-that and I thought "Yes, I get it it's using a directed acyclic graph for storage; now TELL ME HOW TO USE GIT.". The some day it clicked and I thought: "Oh, it's a directed acyclic graph! Everything is so simple now." $\endgroup$ – Odalrick Jul 25 '17 at 14:17
  • $\begingroup$ ...which is again why you should start with Git GUI, which gives you a nice graphical picture of the DAG. $\endgroup$ – T.E.D. Jul 25 '17 at 14:38
3
$\begingroup$

I learned by using StackOverflow and just by being thrown into it. As others have stated using GitHub through an IDE or Desktop version is much easier than the command line. Later on I also found the Codecademy git tutorial

I prefer this method of teaching because its hands on, teaches the user how to use the command line and commands. It also helps with plenty of reference and information as you try these commands in a "live" like environment.

After I learned how to use Git and GitHub I found the above source and it really solidified my knowledge and I hope it does the same for you.

$\endgroup$

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

2
$\begingroup$

The first resource I give to students is this one: https://try.github.io/levels/1/challenges/1.

I've heard great things about Github Patchwork - a mentored workshop for beginners. You may want to look into this for your students if that makes sense for your situation. At the bottom of the Patchwork site, you will find some additional guides and resources.

$\endgroup$

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • $\begingroup$ Can you expand on why this tutorial is better than any other? Without any explanation, this is a link only answer, which would be useless if the link dies. $\endgroup$ – thesecretmaster Aug 20 '17 at 20:09
2
$\begingroup$

There are a few cornerstones to master to establish a good foundation for understanding and using Git.

Purpose

The purpose of git is to control the history and versions of text files. There are two main problems, cooperative writing and controlling edits. E-mailing zip files is terribly inefficient. Edit/Undo is quite limited (no branching) in Microsoft Word or a typical editor - but with Git you get to create different versions as snapshots in time, edit features independently, rollback edits, etc.

Inner Workings

This need not be excessive. The fundamental building block here is the text file 'diff'. Then it is understanding a commit is just a node on a tree where the nodes are connected via diff's. Branches just point towards a commit. This is simple model to understand git.

Visualization

When working with git, you can get lost. For reassurance on what actions to take, a quick look at the history is incredibly helpful. This need not necessitate a GUI, in fact I recommend terminal. Add these aliases to your ~/.gitconfig for help visualizing the source.

[alias]
    lol = log --graph --decorate --pretty=oneline --abbrev-commit
    lola = log --graph --decorate --pretty=oneline --abbrev-commit --all

By fostering these fundamentals, the only thing between novice and expert is experience.

$\endgroup$
  • $\begingroup$ Welcome to Computer Science Educators! This is a very nice answer. I hope we'll be getting more answers and questions from you :) $\endgroup$ – ItamarG3 Jul 24 '17 at 21:08
  • $\begingroup$ Comments are not for extended discussion; this conversation has been moved to chat. $\endgroup$ – thesecretmaster Jul 25 '17 at 0:47
2
$\begingroup$

I learned Git several years ago by reading Pro Git. I found that the first three chapters contain about 90% of what I use on typical projects. The rest is just gravy if you want to dig into more details. All of its examples are command-line and use Linux conventions. Since the Windows version of Git comes with Git Bash, this is not a problem. Most documentation will use the same terminology as the command-line tools, so learning them is crucial. Learning the command-line also helps in understanding GUI tools as well.

$\endgroup$
2
$\begingroup$

Git is a horror show of a user interface built on a fairly clean, simple, purely functional data store. I liked Ben Lynn's "git magic" tutorial, but I'm really here to urge you to try the Magit user interface built in GNU Emacs. It offers these key advantages:

  • You get a screen that presents a visualization of the states of your working tree, your repository, and related remote repositories. This means you can see changes as they happen, which helps you learn and understand.

  • You get prompts for the keystrokes. This means you don't have to memorize the huge command set or trawl through the voluminous man pages.

  • You work with keystrokes, just as you would at the command line. This means you don't have a mouse slowing you down.

  • You will quickly learn to do common operations fast.

The learning curve is still steep. But seeing things change as you chance them is huge.

If you don't already use Emacs, you won't realize all these advantages. But it might still be worth a try.

$\endgroup$
2
$\begingroup$

How do I teach git to a teenager

Git is a powerful repository system, yet much of that power is hidden behind simplicity in day-to-day operations.

Like all good teaching, you need to demonstrate the fundamentals and build from there to instil understanding at the appropriate levels.

What can I do to make this journey easier for me?

Practice. The same materials that are suitable for students are also suitable for you to gain an advanced understanding of what Git is doing and how it operates.

What good user interfaces should I adopt?

My preference for interfaces are

  • Unix (GNU/Linux) command line
  • Unix (GNU/Linux) GUI
  • Microsoft's Windows GUI
  • Microsoft's command line

So it is important, for me, to have a good command line tool, on my GNU/Linux machine. And important to have a good, and the same, GUI on GNU/Linux and Microsoft Windows.

Without hesitation, you should use the official release client from git-scm.com to meet your requirements. The command line tools and git-gui are included. On Fedora (27) Gnu/Linux, you type sudo dnf install git git-gui, and you are done and ready.

Git-gui is a commit tool (git citool to launch the commit interface tool), I mostly use gitk which is a complete repository browser (for the current branch) and launch git-gui from there should I need it but, I do most of my work from the command line - it is simpler although the tree view in gitk is sometimes helpful to understand what has happened before.

If you want a GUI that is a little less encumbering, I recommend Gitg which is available for Microsoft Windows and Gnu/Linux. It is much less full-blown than gitk and accordingly not as powerful. On Fedora (27) Gnu/Linux you type sudo dnf install gitg and type gitg to launch. On Microsoft Windows, you need to make sure that it is on your path. Gitg lets you browse by branches, tags and sources, as well as manage commits, so it is really quite useful.

My goal

  • To use the tool to store the history of my, and pupils, projects.
  • To be able to look at past history.
  • To be able to revert to past state.
  • To merge and resolve conflicts.
  • To never think, that live would be easier without it.

The best resources are tested. Grab yourself a copy of Git from the bottom up and Pro Git (both under CC licence).

By the time that you read through those resources, you should have a good grasp of what is involved.

In order to achieve your goals you are going to have to consider two things:

  1. Set-up Git config to use a basic text editor for most things, like gedit or notepad. It can be very confusing the first time you try and commit on the command line and you forget to include the commit message or, manage a merge. Oh yeah, if you are using the command line, always remember to include the commit message (in two parts, heading and body, separately each by -m) and --signoff.
  2. Decide on your infrastructure. If all students are managing their own repository in their own home folder, then that is fine, that is all that you need but, if you are going to need a Git server, then it is easier to set-up GitHub repositories provided it doesn't matter if student's work is public. Of course, if you have to ask how to set-up a Git server that is a separate (and probably already answered somewhere) ask with a world of possibilities. Setting up a Git server does not need to be overly complicated provided the classroom has the small amount of infrastructure necessary to support it.

Remember, you can always type git commit --help etc. for almost anything.

Good luck!

$\endgroup$
  • $\begingroup$ Welcome to Computer Science Educators! This is a wonderfully detailed answer! I hope we'll see more contributions from you in the future. $\endgroup$ – ItamarG3 Mar 12 '18 at 12:20
1
$\begingroup$

When I was in my final year of university I threw together a quick Git cheat sheet for some fellow students I was working with who were struggling with basic use of Git. The cheatsheet is available as a bitbucket snippet.

Other than that Atlassian has a freely available git gui client for Mac and Windows called sourcetree, I've found it pretty intuitive to learn and use. Following on from that there's another tool called SmartGit which is freely available for non-commercial use and runs on all major operating systems (Win, Mac, Linux). This is an incredibly powerful git tool which gives you access to most of the functionality that Git offers, however it is a proprietary piece of software which you have to pay for if you want to use it for commercial purposes.

I get by using the console commands for 99% of my work, the only time I break out a GUI is when I mess up and need to roll back changes, or for doing other complex operations.

$\endgroup$
1
$\begingroup$

I was just watching https://media.libreplanet.org/u/libreplanet/m/a-free-software-portfolio-the-importance-of-free-software-in-computer-science/

The presenter talk about teachingopensource.org, and how they have put together educational materials for Free and Open Source software. He says that the material is put together my teachers. see teachingopensource.org git search


I got this link from reddit https://learngitbranching.js.org/ maybe it will be of use. But I doubt that it will make git easy to use.


Note: I have not tried these yet.

$\endgroup$
0
$\begingroup$

How I have personally used git, successfully.

I mostly use mercurial. It is like git. It does much the same thing, but is much easier to use. It has a nice command line, and a nice GUI (tortoise hg).

Mercurial has a git plug-in, that allows it to work with git repositories. If there is this git repository, that you want to work on, then you do a clone in mercurial, and now you have it in mercurial (just as you could have done a clone in git). You then work in mercurial, and can push/pull changes back to the upstream repository, or to a friends repository (just as you could have done in git). The only difference is the interface is easier to use.

Disadvantages

When you clone a git repository, you end up with a git repository and a mercurial repository on you local drive. Thus the size of the local repository is roughly double.

Mercurial is not efficient at renames and moves. It does a copy and delete. This may have a fix sometime.


A note on mercurial and git UI

  • The git UI is very low level, it is a thin layer over the API.
  • The git GUIs that I have used are a thin vale over this API or a UI. It does not help. It does display all of the commands, in a nice menu, but you will still be at a loss to decide which command is the right one.
  • The mercurial UI is well thought out, there is mostly a one to one mapping between commands and concepts. It is simple and follows the Unix way, each command does one thing well.
  • The mercurial GUI (tortoisehg), integrated with the file-manager, provides good visuals of the repository, and gives access to tools without having to remember commands (so good for beginners, for operations you do rarely, and for operations that need better visual display).
$\endgroup$
  • $\begingroup$ Can the person that down voted. please give feedback. Formative feedback (this is how you can do better, this is where you are wrong) is of value, Sumative feedback (grades) is not. $\endgroup$ – ctrl-alt-delor Jan 3 '18 at 16:54
-1
$\begingroup$

First up, I would strongly recommend staying away from Git GUI tools. Whether you a student (for whom everything is new) or someone who has worked but is new to git itself, command line should be where you should start.

Second, Till about 3 years ago, I did not know anything about git. Here is how I learnt.

  1. Visited Github (and later Bitbucket, which is more appealing to my students because most of its features are free) and signed up for an account.
  2. Created a new project. Right away, they would give you straightforward instructions on what to do next from the command line.
  3. (optional step) if git is not installed, use any of the hundreds of videos or blogs on how to install and get it configured.

For instance, when I create a new project on bitbucket, and I get these concise instructions.

I have an existing project

Step 1: Switch to your repository's directory

cd /path/to/your/repo

Step 2: Connect your existing repository to Bitbucket

git remote add origin https://Jay_sn@bitbucket.org/Jay_sn/demo_repo_1.git
git push -u origin master

I'm starting from scratch

git clone https://Jay_sn@bitbucket.org/Jay_sn/demo_repo_1.git
cd demo_repo_1
echo "# My project's README" >> README.md
git add README.md
git commit -m "Initial commit"
git push -u origin master

It really cannot get simpler than that.

$\endgroup$
  • 2
  • $\begingroup$ I read through all the answers and realised that what helped me 2 years ago, the simple stuff, wasn't there. I have used this technique in live training sessions and it has helped hundreds of students. When it comes to training and learning things, I believe that there is one right method. there are many methods, and the more the merrier. The post is about making GIT easy. I shared what made it easy for my students :) $\endgroup$ – Jay Aug 21 '17 at 4:01
  • $\begingroup$ (not able to edit my comment so posting this here) in the above comment, 'I believe that there is one right method'. I meant, "I believe that there is no one right method" :) $\endgroup$ – Jay Aug 21 '17 at 5:31
  • $\begingroup$ Yes, it's great that you are willing to share your experiance, but you still havn't explained how your experiance is any different from the other answer I linked. $\endgroup$ – thesecretmaster Aug 21 '17 at 11:14
  • $\begingroup$ I am sorry man, but I really have nothing else to add. I thought this forum was about sharing experiences. I checked all the other answers. I believe things can be a little more succinct. If my answer is so bad (or spam, accidentally), I am sure it should and will get down voted into oblivion, and I will be schooled. However, after your comments, I ran this page and all the answers including mine with my own students. So, I will stick with my answer and I do believe it adds some value to the discussion here. $\endgroup$ – Jay Aug 21 '17 at 11:43

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.