Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
git_tutorial
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
orestis.malaspin
git_tutorial
Commits
4f37fa08
Commit
4f37fa08
authored
7 years ago
by
orestis.malaspin
Browse files
Options
Downloads
Patches
Plain Diff
ajout de tonnes de trucs...
parent
9e596230
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+8
-1
8 additions, 1 deletion
Makefile
git_tutorial.md
+166
-9
166 additions, 9 deletions
git_tutorial.md
with
174 additions
and
10 deletions
Makefile
+
8
−
1
View file @
4f37fa08
BEAMEROPTIONS
=
-t
beamer
BEAMEROPTIONS
+=
--pdf-engine
=
pdflatex
BEAMEROPTIONS
+=
--default-image-extension
=
pdf
BEAMEROPTIONS
+=
-V
theme:metropolis
BEAMEROPTIONS
+=
-V
themeoptions:numbering
=
none
-V
themeoptions:progressbar
=
foot
BEAMEROPTIONS
+=
-V
fontsize
=
smaller
default
:
git_tutorial.md
default
:
git_tutorial.md
pandoc
-s
-t
beamer
-o
git_tutorial.pdf git_tutorial.md
--highlight-style
kate
--filter
=
pandoc-numbering
--number-sections
--filter
=
$(
PANDOC_CROSSREF
)
pandoc-crossref
pandoc
-s
$(
BEAMEROPTIONS
)
-o
git_tutorial.pdf git_tutorial.md
\ No newline at end of file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
git_tutorial.md
+
166
−
9
View file @
4f37fa08
...
@@ -4,19 +4,19 @@
...
@@ -4,19 +4,19 @@
Il existe énormément de très bons documents et tutoriels en ligne:
Il existe énormément de très bons documents et tutoriels en ligne:
-
https://git-scm.com/
-
[
https://git-scm.com/
](
https://git-scm.com/
)
-
-
[
https://try.github.io/
](
https://try.github.io/
)
Des tas de repo en ligne:
Des tas de repo en ligne:
-
https://githepia.hesge.ch
-
[
Githepia
](
https://githepia.hesge.ch
)
-
https://www.github.com
-
[
Githhub
](
https://www.github.com
)
-
https://www.gitlab.com
-
[
Gitlab
](
https://www.gitlab.com
)
Et des GUI assez utiles:
Et des GUI assez utiles:
-
GitExtensions
:
https://gitextensions.github.io/
-
[
GitExtensions
](
https://gitextensions.github.io/
)
-
GitKraken
:
https://www.gitkraken.com/
-
[
GitKraken
](
https://www.gitkraken.com/
)
# Qu'est-ce que Git?
# Qu'est-ce que Git?
...
@@ -43,5 +43,162 @@ Typiquement un projet git possède un serveur "officiel" géré par l'administra
...
@@ -43,5 +43,162 @@ Typiquement un projet git possède un serveur "officiel" géré par l'administra
-
Modifier localement le projet et publier (push) ses propres modifications (sur son serveur à lui).
-
Modifier localement le projet et publier (push) ses propres modifications (sur son serveur à lui).
-
Demander au gestionnaire du projet de fusionner (merge) ses modifications avec le serveur "officiel" (pull request):
-
Demander au gestionnaire du projet de fusionner (merge) ses modifications avec le serveur "officiel" (pull request):
-
L'administrateur récupère le projet depuis le serveur du développeur.
-
L'administrateur récupère le projet depuis le serveur du développeur.
-
Fusionne le projet officiel avec celui modifié.
-
Fusionne le projet officiel avec celui modifié (merge).
-
Publie les modifications sur le serveur officiel.
-
Publie les modifications sur le serveur officiel (push).
\ No newline at end of file
# Exemple de fonctionnement
## Création du dépôt et clone
1.
Création d'un dépôt
*tutorial*
git sur
[
https://githepia.hesge.ch
](
https://githepia.hesge.ch
)
.
2.
Clone du dépôt.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{.bash .numberLines}
$ git clone ssh://git@ssh.hesge.ch:10572/orestis.malaspin/tutorial.git
Cloning into 'tutorial'...
warning: You appear to have cloned an empty repository.
$ cd tutorial
[tutorial]$
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
3.
Et voilà vous êtes dans votre dépôt git.
# Ajout de fichiers à l'historique (1/3)
## Commandes: `git add`, `git status`, `git commit`, `git push`
1.
Création du fichier
`premierfichier.c`
.
2.
Ajout du
`premierfichier.c`
aux fichiers suivis par git.
3.
*Commit*
du fichier ajouté à l'historique des modifications.
4.
*Push*
de l'état de l'historique sur le serveur.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{.bash .numberLines}
[tutorial]$ echo Hello World > premierfichier.c
[tutorial]$ git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
premierfichier.c
nothing added to commit but untracked files present (use "git add" to track)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
# Ajout de fichiers à l'historique (2/3)
## Commandes: `git add`, `git status`, `git commit`, `git push`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{.bash .numberLines}
[tutorial]$ git add premierfichier.c
[tutorial]$ git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: premierfichier.c
[tutorial]$ git commit -m "mon premier commit"
[master (root-commit) a4f2052] mon premier commit
1 file changed, 1 insertion(+)
create mode 100644 premierfichier.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
# Ajout de fichiers à l'historique (3/3)
## Commandes: `git add`, `git status`, `git commit`, `git push`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{.bash .numberLines}
[tutorial]$ git status
On branch master
Your branch is based on 'origin/master', but the upstream is gone.
(use "git branch --unset-upstream" to fixup)
nothing to commit, working tree clean
[tutorial]$ git push
Counting objects: 3, done.
Writing objects: 100% (3/3), 238 bytes | 238.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ssh://ssh.hesge.ch:10572/orestis.malaspin/tutorial.git
* [new branch] master -> master
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
# Modification de fichiers dans l'historique (1/3)
## Commandes: `git diff`, `git log`
1.
Modification du fichier
`premierfichier.c`
.
2.
Ajout/commit/push des modifictations.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{.bash .numberLines}
[tutorial]$ echo Wild World > premierfichier.c
[tutorial]$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: premierfichier.c
no changes added to commit (use "git add" and/or "git commit -a")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
# Modification de fichiers dans l'historique (2/3)
## Commandes: `git diff`, `git log`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{.bash .numberLines}
[tutorial]$ git diff
diff --git a/premierfichier.c b/premierfichier.c
index 557db03..9622e40 100644
--- a/premierfichier.c
+++ b/premierfichier.c
@@ -1 +1 @@
-Hello World
+Wild World
[tutorial]$ git commit -am "nouvelles modifications"
[master f9ab3ec] nouvelles modifications
1 file changed, 1 insertion(+), 1 deletion(-)
[tutorial]$ git push
Counting objects: 3, done.
Writing objects: 100% (3/3), 274 bytes | 274.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ssh://ssh.hesge.ch:10572/orestis.malaspin/tutorial.git
a4f2052..f9ab3ec master -> master
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
# Modification de fichiers dans l'historique (3/3)
## Commandes: `git diff`, `git log`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{.bash .numberLines}
[tutorial]$ git log
commit f9ab3ec4a00c46a12d7a45f133295acc5fb5cd20 (HEAD -> master, origin/master)
Author: Orestis Malaspinas <orestis.malaspinas@hesge.ch>
Date: Sun Mar 4 22:48:21 2018 +0100
nouvelles modifications
commit a4f2052147a752a8c12641f4f3352c5aa1802559
Author: Orestis Malaspinas <orestis.malaspinas@hesge.ch>
Date: Sun Mar 4 22:25:24 2018 +0100
mon premier commit
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
# Revenir en arrière dans l'historique (1/3)
## Commandes: `git checkout`, `git reset`
1.
Faire une modification dans un fichier qu'on aurait pas dû faire.
2.
Faire un
`git add`
qu'on aurait pas dû faire.
3.
Faire un
`git commit`
qu'on aurait pas dû faire.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment