« Git Cheat Sheet » : différence entre les versions

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... »)
(Aucune différence)

Version du 23 août 2017 à 15:29

Create

Create a new repository

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 origin master

Existing folder

cd existing_folder
git init
git remote add origin git@exemple.org: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 git@exemple.org: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

git commit

Push change to origin (the server)

git push

Shortcut

Commit the previously staged changes with the commit message

git commit -m"meaningful message"

Add all changes of modified files and commit them

git commit -a