Git tutorial, getting started with Git

Below is a short comprehensive description of getting Git up and running in just a few minutes. I personally use OSX as a development machine and so the installation part of Git will cover an installation on OSX. If you like to install Git on another platform please take a look at the Git installation documentation. There are a lot of other ways to install Git, but the one described below seems to bring the least hassle on OSX.

Install Git and add your first project

  • First download the installer at the Google Git OSX installer project, http://code.google.com/p/git-osx-installer/downloads/list after running the installer you are good to go.
  • After this easy GUI installation it’s time to startup the terminal, although if you really are into GUI’s you can also download and install OpenInGitGui which can be found at http://code.google.com/p/git-osx-installer/wiki/OpenInGitGui. In your terminal go to the directory where your website is located and initialize a new repository here.

    $cd site_directory
    $git init

    You should now get a response like “Initialized empty Git repository in site_directory/.git/”. The next step is to add the current directory and all of its contents to the repository.

    $git add .
    $git commit -m "Initial import"

    You will now see that all files and directories are committed.

Basically this is it, nothing more to it. You could now start working with Git. Off course we can configure the Git installation just a little bit to set things right.

Basic configuration of Git, ignoring files and configuring the user settings
Whenever you will type “git status” on the current directory you will see if there are any changes that need to be committed, if so you can add them with the “commit” command like we did before. One of the first problems that you will bump into is that your cache files will also be committed. I personally don’t want to commit automatically created cache files or user content. So how can we deal with this? We can create a “.gitignore” file in the root of our project. You can find an example of the .gitignore file below.

*.cache
files

Now any file that has the *.cache extension will be ignored, also all the user content in the files directory will be ignored. This keeps our repository clean. By executing “git show” after committing the .gitignore file you will see that our ignore rules are correctly interpreted.

When you view the Git commit log of the project (“git log”) you will see that Git has already automatically used an author name and email address in the commits we did so far. These values are automatically detected by Git that examined your system configuration. You can change your name and email by executing the following commands:

$git config --global user.name Sjoerd Maessen
$git config --global user.email youremail@address.com

Taking advantage of Git
Off course we didn’t install Git just to add one project and change some basic settings. The power in any version control system is to make checkouts, revert and diff changes. Below you can find some basic commands that you will need to master.

$git checkout thepath
$git diff commitid1 commitid2
$git diff -- filepath
$git revert commitid1

The commands are pretty self explaining like all other commands of Git. If you already worked with other version control systems their is one thing to be aware of, “git revert” doesn’t behave like “svn revert” for example. “Git revert” will do a new commit to reverse a previous one, if you would like to undo your changes you should use “git checkout” instead. The things I have showed above are only small aspects of what Git is capable of. Cloning repo’s, tagging, branching, patching and resolving conflicts are all aspects that will make your life a lot easier, check them out at the Git community book

One more thing
There are some Git GUI repository browsers available that let you view who, why and when something was committed. One that is easy to setup and PHP only is viewgit, give it a try it will just run from your webserver!

http://viewgit.sourceforge.net

Comments

1,167 responses to “Git tutorial, getting started with Git”

  1. https://mreza.mk/@marylouc089895?page=about Avatar

    References:

    How do anabolic steroids cause liver damage

    References:
    https://git.mauve.haus/samuel76478556

  2. 62.173.140.174 Avatar

    References:

    Where can i buy anabolic steroids

    References:
    https://git.smart-tool.jp/demetriavalent

  3. gitea.yantootech.com Avatar

    References:

    Statistics on anabolic steroids

    References:
    http://81.70.30.91:3000/sheliabradshaw

  4. 114.247.226.83 Avatar

    References:

    What type of drug are steroids

    References:
    https://git.veraskolivna.net/denicestolp07

  5. gitea.hadi.es Avatar

    References:

    Anabolic steroids statistics

    References:
    http://47.103.78.70:3000/wyattmcevilly8

  6. howeasynetwork.com Avatar

    References:

    Workout supplement store

    References:
    http://gitea.huangyanjie.com/wilhelminatopp

  7. sportsdungeon.com Avatar

    References:

    Muscle building pills gnc

    References:
    https://git.apextoaster.com/ezraa58183348

  8. https://7yue.net Avatar

    References:

    Natural anabolic steroids

    References:
    https://tea.neuron.my/orvalbacote93

  9. git.vezpi.com Avatar

    References:

    How to get big quick without steroids

    References:
    https://645123.com/@alysa78684669?page=about

  10. tovegans.tube Avatar

    References:

    Drugs for muscle growth

    References:
    https://tiktub.com/@colleenmutch67?page=about

  11. gitea.tecamino.com Avatar

    References:

    Steroid for bodybuilding

    References:
    http://112.74.106.216:3000/phojerome40467

  12. kingdom casino nz Avatar

    Honest Kingdom Casino NZ review: 200NZ$ bonus for new players, 100 free spins, VIP program, fast withdrawals. Licensed casino for New Zealand.

  13. kingdom casino Avatar

    Honest Kingdom Casino NZ review: 200NZ$ bonus for new players, 100 free spins, VIP program, fast withdrawals. Licensed casino for New Zealand.

  14. git.lolpro11.me Avatar

    References:

    Illegal anabolic steroids before and after

    References:
    https://tubepeer.com/@analisa58n7224?page=about

  15. http://47.109.30.152 Avatar

    References:

    Interesting facts about steroids

    References:
    https://git.esen.gay/salssn0341927

  16. https://www.propose.lk Avatar

    References:

    Are anabolic steroids safe

    References:
    http://175.27.229.211:3000/santiagolowry

  17. freshteenclips.com Avatar

    References:

    What do all steroids contain in their structure

    References:
    https://gitea.brmm.ovh/bertha88917914

  18. 8.155.160.224 Avatar

    References:

    Are there legal steroids

    References:
    https://adlr.cig22.com/louannyjl18779

  19. 20.219.0.85 Avatar

    References:

    Where to buy anabolic steroids online

    References:
    https://nildigitalco.com/@susanalangler?page=about

  20. https://git.vhdltool.com/ Avatar

    References:

    Steroid injection for bodybuilding price

    References:
    https://live.eposbd.net/@zanelovekin14?page=about

  21. https://shiatube.org/ Avatar

    References:

    Steroids and athletes

    References:
    http://60.247.225.25:3000/larryburdine23

  22. gitea.biboer.cn Avatar

    References:

    Bradley martin steroids

    References:
    https://buzzafricanmusic.com/alyciafranklyn

  23. https://git.huwhy.cn/cathybenson129 Avatar

    References:

    Difference between anabolic and androgenic

    References:
    https://www.xtrareal.tv/@bradfarncomb65?page=about

  24. https://gitea.brmm.ovh/tcrantonetta23 Avatar

    References:

    Anabolic steroids for back pain

    References:
    http://62.43.207.91:8889/dwainforsyth57

  25. https://124.70.144.1/annmariea62525 Avatar

    References:

    Which of the following compounds is not derived from cholesterol?

    References:
    https://git.miasma-os.com/ervindisney313

  26. git.lifetop.net Avatar

    References:

    List of anabolic steroids

    References:
    https://hearty.rip/hildakeith2240

  27. vidspaceaiapp.com Avatar

    References:

    Steroid alternative supplements

    References:
    http://git.dglyoo.com/groverarmit814

  28. https://git.vezpi.com Avatar

    References:

    Which steroids are legal

    References:
    http://www.skwcf.top/junkomeiners85

  29. 82.156.89.21 Avatar

    References:

    Monster cuts supplement

    References:
    http://z.duowenlvshi.com/nidav718108920

  30. git.cymnb.com Avatar

    References:

    How can you tell if someone is using steroids

    References:
    https://clipsshort.com/@beatrispinner?page=about

  31. lordhub.vip Avatar

    References:

    How do steroids look like

    References:
    http://106.52.71.204:9005/ernestferretti

  32. volts.howto.co.ug Avatar

    References:

    Pills to get ripped and big

    References:
    https://git.csi-kjsce.org/jefferyshute4

Leave a Reply

Your email address will not be published. Required fields are marked *