diff --git a/README.md b/README.md new file mode 100644 index 0000000..fa1bcc8 --- /dev/null +++ b/README.md @@ -0,0 +1,209 @@ +% git-demo +% Nicolas Borboën +% 2015-09-14 + + + +# Git-demo project +The aim of this repo is to provide a smiple tutorial about git usage. You will need **git**^[Information about installing git on your system can be found here: https://git-scm.com/download/] and a **merge tool**^[Many merge tool are avalaible but [Meld](http://meldmerge.org) is a good multi-plateforme candidat]. + +## Define your git public informations + +1. Set you username + + `$ git config --global user.name "Your Name Comes Here"` + +1. Set you email + + `$ git config --global user.email you@yourdomain.example.com` + + +## Basics commands + +This section present all the "every day" git commands. How to clone a git repository locally, add files, commit changes, push to repository and pull from repository. + + +1. Create a projet on gitlab.epfl.ch / github.com + or initialize a local project with the command + + `$ git init` + +1. Clone the project on your computer + + `$ git clone username@host:/path/to/repository` + + `$ git clone https://gitlab.epfl.ch/sti-it/git-demo.git` + +1. Edit the file foo.md + +1. Commit your modification + + `$ git commit -m "My modifications details" foo.md` + +1. Create a new file + + `$ vim myTestFile.txt` + +1. Add the new file to git + + `$ git add myTestFile.txt` + + and commit it. + +1. Check your modification + + `$ git status` + +1. Push your modification + + `$ git push` + +1. Browse to the repository page to see the modification + +1. Others collaborators of the repository can now update their files to see your changes with + + `$ git pull` + +## Read the log +1. View all the logs + + `git log` + +1. View the log of a specified author + + `git log --author=bob` + +1. Test some logs option + + `git log --pretty=oneline` + + `git log --graph --oneline --decorate --all` + + `git log --name-status` + + `git log --help` + +1. Note that you can use the following command to search for strings in any version of your project: + + `$ git grep "hello"` + + +## Conflicts management +1. Reset changes you made to a file + + `$ git checkout -- ` + +1. Set the tool you want to use to resolve conflict + + `$ git mergetool` + +1. Resets any changes to tracked files: + + `$ git reset --hard origin/master` + + Resets the index and working tree. Any changes to tracked files in the working tree since are discarded. + +1. If you want to be more delicate than the latest command, you can use: + + `$ git revert ` + + Reverting has important advantag over resetting as it doesn’t change the project history, which makes it a “safe” operation for commits that have already been published to a shared repository. + +## Managing branches +1. Create a new branch + + `$ git branch myTest` + +1. List the branches of your project + + `$ git branch` + + myTest + master* (<-- current branch) + +1. Change the branch with the command + + `$ git checkout myTest` + +1. Now edit the foo.md file and commit it, then change back on master branch + + `$ git checkout master` + + Check that the change you made is no longer visible, since it was made on the myText branch and you’re back on the master branch. + +1. Now you can edit files on the master branch, but at one point you may want to bring back the changes made on myTest to master branch: + + `$ git merge myTest` + + If the changes don’t conflict, you’re done. If there are conflicts, markers will be left in the problematic files showing the conflict. + +1. Check the markers with the diff command: + + `$ git diff` + +1. Now edit the file to resolve the conflicts and commit the changes made to the file. You can use the tool "gitk" to graphically see the resulting history. + + `$ gitk` + +1. As the changes made to the myTest branch are now merged, you can delete this branch: + + `$ git branch -d myTest` + + +## Cleaning up +1. Remove branches + + `$ git branch` + + and + + `$ git branch -D ` + +1. Revert and commit you changes to the initial commit + + `$ git revert xxxxxx` + +## Documentation and links + +### RTFM +* `man git` +* `man 7 gittutorial` +* `man 7 gitworkflows` + +### On the www + +#### Official +* [Documentation](http://git-scm.com/doc) +* [Books](http://git-scm.com/book/en/v2) +* Cheat Sheets: [EN](https://training.github.com/kit/downloads/github-git-cheat-sheet.pdf) - [FR](https://training.github.com/kit/downloads/fr/github-git-cheat-sheet.pdf) + +#### Good alternative documentation +* [Roger Dudler](http://rogerdudler.github.io/git-guide/) +* [Atlassian](https://www.atlassian.com/git/) + +### Courses +* [GitHub](https://training.github.com/) +* [CodeSchool](https://www.codeschool.com/courses/try-git/goto) +* [Git Immersion](http://gitimmersion.com/) + +### Documentation in French +* [OpenClassRooms](http://openclassrooms.com/courses/gerez-vos-codes-source-avec-git) +* [Polytechnique.fr](http://www.lmd.polytechnique.fr/~dkhvoros/teach/tutoriel-git.pdf) + diff --git a/README.pdf b/README.pdf new file mode 100644 index 0000000..f2a9e61 Binary files /dev/null and b/README.pdf differ diff --git a/foo.md b/foo.md new file mode 100644 index 0000000..aa98483 --- /dev/null +++ b/foo.md @@ -0,0 +1,96 @@ +# Corporis bracchia + +## Elin deposuitque parabat saepe reddidit ex inde + +Lorem markdownum arcisque petiitque certe diversaeque, centum! Es nivea dicta +agros et enim quos? + +## Relinquunt auget quondam signaque + +Evellere tutus et in omnia alma sanguineae posuere. Hoc sedit, magna quid vomit, +verecundo e caelique. Terrae dicere; est laboro frustra iam haec Minos, tecti, +Sabinis. Sunt quod, congelat socialia clauserat ego moenia macies! Aratra ille +gratissime [dabat](http://www.wtfpl.net/), duo abluit feram fallis sororis video +lacertis tegumenque: cruris fata Troia litora mare edere. + +- Regna digna promunturiumque pollice +- Et ego carmine vitat neque digna imagine +- Umeris quid +- Ille quod +- Ait non pia parva iniustus nigra + +## Leti incedere collem solidis + +Andraemon vapor ad filia sanguinis saeva reddebant munus iam: maturus, amas. +Seductus colebat dryades ceciderunt volucres ipsa **deum sidera**, ego homo. + +- Sensura cetera +- Artus aera at Pasiphaen excipit sentiri +- Hinc haud formosis laesaque dixerat + +## In veneni exemplum mater + +Thebae et imperat ferunt, sed Oeten mollia? Ad in gravida similes misit non +*animalia insistere vetitae* frugum, dixit mora illam. + +Bene concipit adest [suoque](http://landyachtz.com/)! Te animalia, **dantem ut +custodia** quam rostro dei tauri Minervae; ictu dum aut. + +## Cupidine Aeneia + +Lorem markdownum postquam sed morte nondum **in** dixit reservet gramineo ego +dempsistis? **Litus cum** adhuc, nec cetera, est, sum odiis Phineus membra +petenda limina. Iuvenem neve. Viro quoque longique animos voluere presso. Munera +ipsorum Pedasus fontes oblita ignorantia tuae adventus suspicit, ignavi, +inhibere. + +> A lacus: inque conpendia paulum oculorum misit cultique, retro et atque et +> patriis repulsae mihi. Inscius [dixi iacentem +> in](http://reddit.com/r/thathappened) corpore +> [permaneo](http://reddit.com/r/thathappened) et gerat [litoris +> adverso](http://stoneship.org/), bina quaerenti sapies aquis. Restabat feres +> primum obambulat petit aut, paludibus *prima laesa aut* ignes Boreae! Quo +> tangit cuncta ignotis deus huius sanguine perpetimur nomina et Olympus coxerat +> aggere. + +Revinctam trepidans ipsam. Ipsius terrae agri, spes, **tibi tutior manus**. +Hector viae comitesque genitor speculi, lunae plectrumque tellus Persephones +sensit Belides diversa greges: observo perire amplecti ferrum, diu. + +## Has namque locus votum + +Caelum silices geminata aquas aera serpit dura, *relictis*, ille. Illic fungis +casam molem Tempe; Atlantis Venerem et me arte adest hara, modo donec, ubi! +Latonae murmure exclamat [quicumque](http://www.thesecretofinvisibility.com/), +tinguamus hic est laterumque frena umbrosum in carinis portusque nato innoxia, +latus ego Pallas. Prope donasse sumptoque si **vestra Acasto**; non genitam +adamanta. + +Mugitus iacuere medium fecundus semel iactatis habemus falsa, melius? Tot rex ab +conreptus fugis fodiebant verbere clara velamina delubra *gentis* est. Ergo +consulat cruorem inperfectus laeva imitatus levata, quam modo mirabile; frustra. + + monochrome_macintosh = file_registry_udp(username); + var developmentCdmaSystray = computer.ios(-3, romCtp); + mp.kilohertzIsoChipset = iscsi(hibernateMemoryRegular + bus_navigation, 2); + routerFile(wired_namespace(smishingSolid, signatureGuiVga - + diskCompression)); + +## Aures iustitia quae pars femina + +Est dicta petit parvoque pariterque apertum aegre. Totis et tamen cladibus alta +[inficit Arethusa utque](http://news.ycombinator.com/), est damno veni +Rhodanumque dedecus; est iuvenes sepulcro. Artus fata agmine invenio inhibere? +Arvo vini exspectat ferunt [tandem](http://omfgdogs.com/), e silvas colorem et +aberant. Tamen animosque suos Actaeo et [inertes](http://omfgdogs.com/) sed +pereunt Persea terrore Phoebe. + +> Non **Austro discedentem** silvis omnia illa telo: corniger turpe sorsque. Ire +> orbi lyramque visa cassis crudus, ut me proelia Desine cum traxit premis +> accensis potentia Phoronide hinc. Mucrone dari: passim, vicinia acclinia +> virides rogat utque dei sidera hunc tendensque; sua. + +Quae umoris virgo pudibundaque recens: numina malo fuit mihi albente, nec +oraque. Funestas quid tangi. Ulla finem discrimine **indomitas orsa**, hanc ille +**haud iuranda**. Pro malis cum, erat coniunx aquas tunc? +