User Tools

Site Tools


Sidebar

git

This is an old revision of the document!


Setup own GIT repository

Server

git config --global user.name "John Doe"
 git config --global user.email johndoe@example.com
 git config --global core.editor vim
 git config --list

 mkdir ~/git/project
 cd ~/git/project
 git init --bare

Client

ssh-keygen -t rsa
 ssh-copy-id -p22 user@123.45.56.78

 git config --global user.name "Local User"
 git config --global user.email johndoe@example.com
 git config --global core.editor vim
 git config --list


 cd ~/project
 git init
 vim my_file.txt
 git add .
 git commit
 git remote add MyProject ssh://user@server.com/~/git/MyProject
 git push -u MyProject master 
 git status

Add some color

git config --global color.ui auto

Clone a repo

cd ~/
 git clone ssh://user@myserver.com/~/git/project

See the changes

git log --oneline

You don't need the –oneline flag, this just shortens the response so it's easier to read. View the following link for further examples and explanations:

You can also add the following to yout git config file: vim ~/.gitconfig [log]

  date = relative

[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 : 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

Using GIT

Get started

apt-get install git git-core Example for starting a local repo based on what you have from github: git clone https://github.com/sampson-chen/sack.git cd emerald ls -l ./configure –options make sudo make install

To see the status of the repo, do:

git status Example for syncing your local repo to more recent changes on github: git pull

To pull a specific branch: git clone -b colors https://g.blicky.net/ncdu.git

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 autoreconf -i

git.1623415203.txt.gz · Last modified: 2021/06/11 05:40 by vissie