Mini tutorial emphasizing uses in multidisciplinary projects! Git/github is not just for coders!
*If you also love git and are trying to get your team to use it, feel free to contribute!
The first and most important thing you have to ask yourself is: Why, why, why am I still in Windows?
The second thing to ask yourself is: Why do I keep doing this to myself?
If you choose not to hear this advice, here's what you gotta do to have git on Windows.
###Fedora
$ yum install git-core
###Debian
$ apt-get install git
Hahaha you spent a LOT of money! Don't be so fresa.
Did you see how easy it was for Linux users? There are two ways for you:
- Via the git installer
- With MacPorts installed:
$ sudo port install git-core +svn +doc +bash_completion +gitweb
Git (or github) is, in my opinion, a pretty awesome way to work in teams because it facilitates sharing and integrating work and it makes everyone accountable for the tasks that are assigned to them.
For the second reason, you have to tell github who you are:
$ git config --global user.name "Your Name"
$ git config --global user.email "[email protected]"
Once you do this, everything that you upload/update/do will have your name attached in the history of your repo (accountability FTW!)
One last thing...
If on a Mac also add:
$ git config --global core.autocrlf input
$ git config --global core.safecrlf true
If on Windows also add:
$ git config --global core.autocrlf true
$ git config --global core.safecrlf true
This will setup line ending preferences.
You can also tell git which editor you prefer (obviously, my example is with emacs but you plug in your favourite!)
$ git config --global core.editor emacs
Lastly, for resolving merge conflicts, you can setup where you want to do it!
$ git config --global merge.tool emerge
Let's check out our setup:
$ git config --list
No one (and I mean no one) knows everything. Knowing how to access the documentation is always your best bet.
To access git's manpage just do:
$ git help <verb>
$ git <verb> --help
$ man git-<verb>
where refers to any command you want! (If you know not any command, ask Google what you wanna do and start checking out all the possibilities to make your life easier!)
You obviously do not want to add your credentials every single time you want to clone
, pull
or push
from a repo in github.
My prefered choice, is via ssh
. You just have to follow the appropiate instructions for you operating system in here
and you will never again worry about inputing your credentials. It is the safest way to connect your local
versions of the repos with github.
Once your credentials are configured, be sure to clone the repositories using the appropiate ssh connector, that is go to the repo in github, e.g. this tutorial's repo and go to Clone or download on the right top corner and select use ssh as shown:
Copy the url for the repo
Now spin up a terminal and go to the folder where you intend to parent your repo and type
git clone [email protected]:animalito/github_tutorial.git
You can also set it up via https and caching your credential by using the credential helper
To write beautiful stuff (like this document), use Markdown! It really is awesome.
For an amazing cheatsheet.
Incidentally, you can easily turn a markdown file into a presentation! For those RStudio users, checkout this one out.
If you find this useful, want to contribute or whatever, don't be a stranger! Drop us a line.