User Tools

Site Tools


git

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

git [2021/06/11 05:40] – created vissiegit [2021/06/11 05:43] (current) vissie
Line 2: Line 2:
 ===== Server ===== ===== Server =====
 <code>git config --global user.name "John Doe" <code>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 core.editor vim +git config --global core.editor vim 
- git config --list+git config --list
  
- mkdir ~/git/project +mkdir ~/git/project 
- cd ~/git/project +cd ~/git/project 
- git init --bare</code>+git init --bare</code>
  
 ===== Client ===== ===== Client =====
    
 <code>ssh-keygen -t rsa <code>ssh-keygen -t rsa
- ssh-copy-id -p22 user@123.45.56.78+ssh-copy-id -p22 user@123.45.56.78
  
- git config --global user.name "Local User" +git config --global user.name "Local User" 
- git config --global user.email johndoe@example.com +git config --global user.email johndoe@example.com 
- git config --global core.editor vim +git config --global core.editor vim 
- git config --list+git config --list
  
- +cd ~/project 
- cd ~/project +git init 
- git init +vim my_file.txt 
- vim my_file.txt +git add . 
- git add . +git commit 
- git commit +git remote add MyProject ssh://user@server.com/~/git/MyProject 
- git remote add MyProject ssh://user@server.com/~/git/MyProject +git push -u MyProject master  
- git push -u MyProject master  +git status</code>
- git status</code>+
  
 ===== Add some color ===== ===== Add some color =====
Line 35: Line 34:
 ===== Clone a repo ===== ===== Clone a repo =====
 <code>cd ~/ <code>cd ~/
- git clone ssh://user@myserver.com/~/git/project</code>+git clone ssh://user@myserver.com/~/git/project</code>
  
 ===== See the changes ===== ===== See the changes =====
Line 42: Line 41:
  
 You can also add the following to yout git config file: You can also add the following to yout git config file:
- vim ~/.gitconfig +vim ~/.gitconfig 
- [log] +<sxh bash; gutter: false> 
-    date = relative +[log] 
- [format] +   date = relative 
-    pretty = format:%C(auto,yellow)%h%C(auto,magenta)% G? %C(auto,cyan)%>(15,trunc)%ad %C(auto,green)%<(16,trunc)%aN%C(auto,reset)%s%C(auto,red)% gD% D +[format] 
- +   pretty = format:%C(auto,yellow)%h%C(auto,magenta)% G? %C(auto,cyan)%>(15,trunc)%ad %C(auto,green)%<(16,trunc)%aN%C(auto,reset)%s%C(auto,red)% gD% D 
-if you need branch info, try adding %C(yellow)%d%Creset : +#if you need branch info, try adding %C(yellow)%d%Creset : 
- pretty = format:%C(auto,yellow)%h%C(auto,magenta)% G? %C(auto,cyan)%>(15,trunc)%ad %C(auto,green)%<(16,trunc)%aN%C(auto,reset)%s%C(auto,red)% gD% D %C(yellow)%d%Creset +pretty = format:%C(auto,yellow)%h%C(auto,magenta)% G? %C(auto,cyan)%>(15,trunc)%ad %C(auto,green)%<(16,trunc)%aN%C(auto,reset)%s%C(auto,red)% gD% D %C(yellow)%d%Creset 
 +</sxh>
 ====== Using GIT ====== ====== Using GIT ======
 ===== Get started ===== ===== Get started =====
- apt-get install git git-core+<code>apt-get install git git-core</code>
 Example for starting a local repo based on what you have from github: Example for starting a local repo based on what you have from github:
- git clone https://github.com/sampson-chen/sack.git +<code>git clone https://github.com/sampson-chen/sack.git 
- cd emerald +cd emerald 
- ls -l +ls -l 
- ./configure --options +./configure --options 
- make +make 
- sudo make install+sudo make install</code>
 ===== To see the status of the repo, do: ===== ===== To see the status of the repo, do: =====
- git status+<code>git status</code>
 Example for syncing your local repo to more recent changes on github: Example for syncing your local repo to more recent changes on github:
- git pull+<code>git pull</code>
  
 To pull a specific branch:  To pull a specific branch: 
- git clone -b colors https://g.blicky.net/ncdu.git+<code>git clone -b colors https://g.blicky.net/ncdu.git</code>
  
 If you're building directly from the git repository, make sure you have perl (or rather, pod2man), pkg-config and GNU autoconf/automake installed, then run 'autoreconf -i', and you're ready to continue with the usual ./configure and make route. If you're building directly from the git repository, make sure you have perl (or rather, pod2man), pkg-config and GNU autoconf/automake installed, then run 'autoreconf -i', and you're ready to continue with the usual ./configure and make route.
  
- sudo apt-get install autoconf automake +<code>sudo apt-get install autoconf automake 
- autoreconf -i+autoreconf -i</code>
  
git.1623415203.txt.gz · Last modified: 2021/06/11 05:40 by vissie