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
7e7ebb67
Commit
7e7ebb67
authored
7 years ago
by
orestis.malaspin
Browse files
Options
Downloads
Patches
Plain Diff
git rm fait.
parent
b8555c9f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
git_tutorial.md
+102
-5
102 additions, 5 deletions
git_tutorial.md
with
102 additions
and
5 deletions
git_tutorial.md
+
102
−
5
View file @
7e7ebb67
...
...
@@ -196,7 +196,7 @@ Date: Sun Mar 4 22:25:24 2018 +0100
mon premier commit
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
# Revenir en arrière dans l'historique (1/
5
)
# Revenir en arrière dans l'historique (1/
6
)
## Commandes: `git checkout`, `git reset`
...
...
@@ -219,7 +219,7 @@ Changes not staged for commit:
no changes added to commit (use "git add" and/or "git commit -a")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
# Revenir en arrière dans l'historique (2/
5
)
# Revenir en arrière dans l'historique (2/
6
)
## Commandes: `git checkout`, `git reset`
...
...
@@ -235,7 +235,7 @@ nothing to commit, working tree clean
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
# Revenir en arrière dans l'historique (3/
5
)
# Revenir en arrière dans l'historique (3/
6
)
## Commandes: `git checkout`, `git reset`
...
...
@@ -257,7 +257,7 @@ Unstaged changes after reset:
M premierfichier.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
# Revenir en arrière dans l'historique (4/
5
)
# Revenir en arrière dans l'historique (4/
6
)
## Commandes: `git checkout`, `git reset`
...
...
@@ -285,7 +285,7 @@ index 9622e40..cfd5469 100644
+Oh no! An awful modification!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
# Revenir en arrière dans l'historique (
4/5
)
# Revenir en arrière dans l'historique (
5/6
)
## Commandes: `git checkout`, `git reset`
...
...
@@ -295,6 +295,103 @@ index 9622e40..cfd5469 100644
[tutorial]$ git commit -am "troisieme commit"
[master 0563c02] troisieme commit
1 file changed, 1 insertion(+), 1 deletion(-)
[tutorial]$ git push
[tutorial]$ git reset f9ab3ec4a00c46a12d7a45f133295acc5fb5cd20
[tutorial]$ git status
On branch master
Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded.
(use "git pull" to update your local branch)
Changes not staged for commit:
modified: premierfichier.c
no changes added to commit
[tutorial]$ git checkout premierfichier.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
# Revenir en arrière dans l'historique (6/6)
## Commandes: `git checkout`, `git reset`
### Faire un `git commit` qu'on aurait pas dû faire.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{.bash .numberLines}
[tutorial]$ echo Wonderful World > premierfichier.c
[tutorial]$ git commit -am "la bonne troisieme modification"
[master 1b42970] la bonne troisieme modification
1 file changed, 1 insertion(+), 1 deletion(-)
[tutorial]$ git status
On branch master
Your branch and 'origin/master' have diverged,
and have 1 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
nothing to commit, working tree clean
[tutorial]$ git pull
Auto-merging premierfichier.c
CONFLICT (content): Merge conflict in premierfichier.c
Automatic merge failed; fix conflicts and then commit the result.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
### Il ne reste qu'à corriger le conflit et refaire un `git commit`, `git push`
# Retirer un fichier du contrôle de version (1/3)
## Commande: `git rm`
-
Il n'est plus nécessaire de suivre un fichier.
-
**Attention**
: le fichier ne disparaît pas de l'historique.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{.bash .numberLines}
[malaspor@perka tutorial]$ git rm premierfichier.c
rm 'premierfichier.c'
[malaspor@perka tutorial]$ git st
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: premierfichier.c
[malaspor@perka tutorial]$ git commit -am "efface donc ce fichier"
[master 8f76d90] efface donc ce fichier
1 file changed, 1 deletion(-)
delete mode 100644 premierfichier.c
[malaspor@perka tutorial]$ ls -ltr
total 0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
# Retirer un fichier du contrôle de version (2/3)
## Commande: `git rm`
-
Il n'est plus nécessaire de suivre un fichier.
-
**Attention**
: le fichier ne disparaît pas de l'historique.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{.bash .numberLines}
[malaspor@perka tutorial]$ git reset bbb151324289dc2f85468f5721ec1021692dd216
Unstaged changes after reset:
D premierfichier.c
[malaspor@perka tutorial]$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: premierfichier.c
no changes added to commit (use "git add" and/or "git commit -a")
[malaspor@perka tutorial]$ ls -ltr
total 0
[malaspor@perka tutorial]$ git checkout premierfichier.c
[malaspor@perka tutorial]$ ls -ltr
total 4
-rw-r--r-- 1 malaspor malaspor 17 5 mar 11:13 premierfichier.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
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