This page is a quick introduction to git , and its regular use via Bitbucket.
This article contains very quick explanations about how to start using and mastering the mighty git software, its installation, and its use thanks to the awesome Bitbucket.
Links are provided to other tutorials and other explanations.
I also use that page to join and publish a few configuration files to improve and customize your use of git, some advices, and some aliases to ease the use of git on the command line (thanks to your ~/.bash_aliases file for the command-line GNU/Bash environment).
Note
Licence ?
This page, and all related files are freely distributed under the terms of the GPLv3 licence ! (like everything I publish or distribute).
The official website of git is git-scm.com.
« Git is a decentralized version control software. This is free software created by Linus Torvalds, Linux kernel copyright and distributed under the terms of the GNU General Public License Version 2. »
« Git is designed to be efficient in speed and ensure the integrity of data stored, sent or received. Completely free and open-source since 2005, it quickly became the most popular version control system for software development. »
« A version control software is a software designed to store a set of files by holding the chronology of all the changes that have been made on it. »
« git allows notably to find all the previous versions of a lot of related files. It also allows an effective and secure control of your files (and even of entire projects) and also provide a complete track changes made to each file. »
Needless to say, I am using git constantly, mainly when I work on Linux ((X)Ubuntu™ 15.10) on a daily basis, and from time to time on Windows™.
Yes:
A little loose, but still in the order from the best reference to the blurrier:
Two documents in PDF to download in order to never panic when you will get lost during your first days with git:
Other resources (less useful, but can help):
Note
And how does it work, really, underneath the nice web interface and command line tools? Is it (theoretically) complicated? :red:`Yes.`
State: | Actively maintained. (November 2014) |
---|
For these two configuration files (on Linux), a global .gitconfig and .gitignore can be in your HOME (~/, or /home/pseudo), and a particular file for every repository can also be created.
You can consult my bash_aliases (also here on Bitbucket.org/lbesson/bin). I defined the following Bash aliases, which allow you to see the changed, deleted or added files:
These ones are good shortcuts, which by default also launches local compression of the just filed after each operation (on average it saves time):
And finally, I have defined an practical alias to synchronize the current project with the deposit mother and its sub-folder on my website.
For instance, that repository is here locally on my website (publis/ansi-colors). That other one is here locally on my website (publis/Bomberman). And that last one is also here locally on my website (python-demos).
Note
Details about aliases Bash?
More information is available in this book about Bash programming, on the Linux documentation project, that other doc, or that last Wikipédia about aliases on generic scripting programming language.
Note
A graphical interface for git?
The use of any good GUI for git can save a lot of time. To write webpages and code, I like Sublime Text 3 (ST3). Regardless of your text editor or IDE, it should be possible to bring this kind of functionality to easily use git without always going through console commands.
For example, Atlassian offers SourceTree, for Windows™ and Mac™ OS X. And GitHub have developed their own application for Mac™ OS X or Windows™.
The following free plugins allow a smooth and easy use of git on Sublime Text 3:
Like the other hosting services, Bitbucket is free, flexible, powerful, 24h/24 and 7/7 functionnal, and allow to easily publish your code on Internet.
Note
GitHub offers pretty much the same (awesome) features, for free too.
Bitbucket offers in addition to the public repositories and unlimited numbers of private repos. Every repos is limited to 2GB (you really have to want to break the system go beyond!). Signing up is quick, just go to this page https://Bitbucket.org/ ! (Note that Bitbucket can also be used with a Google account, Facebook, GitHub or even with OpenID.)
Once your profile is created, it will look like mine, but more empty: Bitbucket.org/lbesson (see this one for another example Bitbucket.org/jilljenn).
Public deposits are visible to all: Bitbucket.org/lbesson/profile/repositories.
For example, here are some of my repositories:
- Bitbucket.org/lbesson/web-sphinx stores the sources of this website, as for instance the reStructuredText (.rst) source code for that (→ and with a direct link to THAT line),
- Bitbucket.org/lbesson/bin hosts dozens of scripts, especially some in Bash and Python
- Bitbucket.org/lbesson/web-sphinx-scripts stores local versions of all Javascript scripts used by this site,
- Bitbucket.org/lbesson/cv stores the \(\LaTeX{}\) sources for my résumés in English and in French: cv.en.tex or cv.fr.tex,
- Bitbucket.org/lbesson/munstrap a small repository hosting my French translation of the theme Munstap, adaptive and modern theme for Munin.
Further reading is available here en.WikiPedia.org/wiki/Bitbucket.
If your username is Bitbucket STUFF, it is possible to create a repository called "STUFF.bitbucket.org", and then all documents will be stored there you will be automatically available on the website http://STUFF.bitbucket.org !
More details are given on cette page de doc par Atlassian, and here is their example (tutorials.bitbucket.org) is online at https://tutorials.bitbucket.org)
(This service is unfortunately a little less advanced than GitHub (GitHub.io, see the doc here), but works well anyway.)
Note
See for example this little page lbesson.Bitbucket.org/README.html whose source is hosted here Bitbucket.org/lbesson/lbesson.bitbucket.org/src/master/README.html.
I mainly use lbesson.Bitbucket.org for:
And even if the certificate is not valid, it is perfectly possible to use this feature with HTTPS activated: https://lbesson.Bitbucket.org/README.html (if your browser rattle and displays an error is perfectly normal!). If you are using a relatively new browser, it may grumble and explain why (you will see that the only reason is that the SSL certificat for https://bitbucket.org has been signed for only a few sub-domains of the website bitbucket.org, not all of them). But in fact the traffic will be well encrypted and secured by the SSL certificate, no worries :)
For a little over a year, it is possible to change the interface of the site in French (and many other languages) in your personal settings.
Note
French translation?
In March and April 2013, I initiated and for some time I managed the translation of the site and the service of the English into French. I translated almost 90% presque 90% du contenu initial, of the original content, left some small typos, but we did a good job. With few other motivated and myself, French was the first language translated to 100%! (Mid March 2013) I have neither the time nor the desire to take care of it, but the project continues to be maintained by others.
As some GitHub fans offer ghbtns.com/ or buttons.GitHub.io/, a Bitbucket fan designed bb-btns.bitbucket.org/.
Here are some examples for my web-sphinx deposit:
The same, but hosted on lbesson.bitbucket.org/bbbtns/ (for my bin repository):
The same, but hosted on my website (./bbbtns/) (for the lbesson.Bitbucket.org repo):
As with any technical and powerful software, git takes time to adapt. Be persistent, it is worth it.
« I wish you a very good programming experience, and good luck for your geeky projects! »
Thanks to Vincent Cohen-Addad for motivating me to start using git, in Octobre 2012 for the network programming project for my Computer Science (CS) Master of Sciecne (MPRI, course #1-21) on which we worked together.