Différences entre les versions de « Git Cheat Sheet »

De wiki-fabmstic
Aller à la navigation Aller à la recherche
(Page créée avec « == Create == Create a new repository <pre> git clone git@exemple.org:fablab/test.git cd test touch README.md git add README.md git commit -m "add README" git push -u origi... »)
 
 
Ligne 1 : Ligne 1 :
 
== Create ==
 
== Create ==
 
Create a new repository
 
Create a new repository
  +
If your using https://gitlab-fabmstic.imag.fr/ see the specificities [[Git and GitLab basics]]
 
<pre>
 
<pre>
git clone git@exemple.org:fablab/test.git
+
git clone https://gitlab-fabmstic.imag.fr/fablab/test.git
 
cd test
 
cd test
 
touch README.md
 
touch README.md
Ligne 14 : Ligne 15 :
 
cd existing_folder
 
cd existing_folder
 
git init
 
git init
git remote add origin git@exemple.org:fablab/test.git
+
git remote add origin https://gitlab-fabmstic.imag.fr/fablab/test.git
 
git add .
 
git add .
 
git commit -m "Initial commit"
 
git commit -m "Initial commit"
Ligne 22 : Ligne 23 :
 
<pre>
 
<pre>
 
cd existing_repo
 
cd existing_repo
git remote add origin git@exemple.org:fablab/test.git
+
git remote add origin https://gitlab-fabmstic.imag.fr/fablab/test.git
 
git push -u origin --all
 
git push -u origin --all
 
git push -u origin --tags
 
git push -u origin --tags
Ligne 41 : Ligne 42 :
 
</pre>
 
</pre>
   
Commit the previously staged changes
+
Commit the previously staged changes, add meaningfull comments
 
<pre>
 
<pre>
 
git commit
 
git commit
Ligne 52 : Ligne 53 :
   
 
== Shortcut ==
 
== Shortcut ==
Commit the previously staged changes with the commit message
+
Commit the previously staged changes with the commit comments
 
<pre>
 
<pre>
git commit -m"meaningful message"
+
git commit -m"meaningful comments"
 
</pre>
 
</pre>
 
Add all changes of modified files and commit them
 
Add all changes of modified files and commit them

Dernière version du 20 septembre 2017 à 12:08

Create

Create a new repository If your using https://gitlab-fabmstic.imag.fr/ see the specificities Git and GitLab basics

git clone https://gitlab-fabmstic.imag.fr/fablab/test.git
cd test
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

Existing folder

cd existing_folder
git init
git remote add origin https://gitlab-fabmstic.imag.fr/fablab/test.git
git add .
git commit -m "Initial commit"
git push -u origin master

Existing Git repository

cd existing_repo
git remote add origin https://gitlab-fabmstic.imag.fr/fablab/test.git
git push -u origin --all
git push -u origin --tags

Get change

Get the change from the server

git pull

Add change

Add changes of a file or a directory to the next commit

git add /path/to/file
git add /path/to/directory

Commit the previously staged changes, add meaningfull comments

git commit

Push change to origin (the server)

git push

Shortcut

Commit the previously staged changes with the commit comments

git commit -m"meaningful comments"

Add all changes of modified files and commit them

git commit -a