Githuh: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(5 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
=== Configuration === | === Configuration === | ||
* User config file<pre>~/.gitconfig</pre> | * User config file<pre>~/.gitconfig</pre> | ||
* Show setting <pre>git config --list --show-origin</pre> | * Show setting and origin <pre>git config --list --show-origin</pre> | ||
==== Basic Setup ==== | ==== Basic Setup ==== | ||
Line 10: | Line 10: | ||
git config --global user.name "John Doe" | git config --global user.name "John Doe" | ||
git config --global user.email johndoe@example.com | git config --global user.email johndoe@example.com | ||
git config --global init.defaultBranch main | |||
git config --global credential.helper store | |||
git config --global core.editor vi | |||
</pre> | </pre> | ||
=== Create Repository === | === Create Repository for an existing code=== | ||
<pre>git init | <pre> | ||
cd /path/to/my/codebase | |||
git init -b main | |||
git add . | |||
git commit | |||
</pre> | |||
=== Set Remote === | === Set Remote === | ||
Line 25: | Line 30: | ||
=== Pull === | === Pull === | ||
<pre>git pull</pre> | <pre>git pull</pre> | ||
=== Difference / Comparaison === | === Difference / Comparaison === | ||
<pre>git diff</pre> | <pre>git diff</pre> |
Latest revision as of 02:17, 3 August 2022
Usefull Git command
Configuration
- User config file
~/.gitconfig
- Show setting and origin
git config --list --show-origin
Basic Setup
- Setup user and email
git config --global user.name "John Doe" git config --global user.email johndoe@example.com git config --global init.defaultBranch main git config --global credential.helper store git config --global core.editor vi
Create Repository for an existing code
cd /path/to/my/codebase git init -b main git add . git commit
Set Remote
git remote set-url origin git@gitlab.com/group/report.git
or
git remote set-url origin https://username:password@gitlab.com/group/repot.git
Pull
git pull
Difference / Comparaison
git diff