GIT

Preparation

git-email

sudo apt-get install git-email
git config sendemail.signedoffcc false
git config sendemail.suppressfrom true

NOTE: Github was disabled git protocol. So only https: or ssh git@ is valid.

git config --global url.https://github.com/daurnimator/lua-systemd.insteadOf git://github.com/daurnimator/lua-systemd
# or
git config --global url.https://.insteadOf git://

Keywords: git protocol, git: protocol

git config --global url.git@github.com:.insteadOf https://github.com/

Import HG (mercurial) repo

sudo apt-get install hg-fast-export
git init
hg-fast-export -r .

Usage

fetch moved tags

git fetch origin --tags --force

Undo a commit

Undo a commit and redo

$ git commit ...              
$ git reset --soft HEAD~1     
<< edit files as necessary >> 
$ git add ....                
$ git commit -c ORIG_HEAD     

Local copy of one branch from public repo

git remote add ti git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git
git remote add tilocal /home/user/mirrors/ti-linux-kernel
git fetch ti refs/heads/ti-linux-3.14.y 
git checkout ti-linux-3.14.y

Now we have latest version from ti-linux-3.14.y branch. Add our local GitLab server

git remote add gitlab ssh://path... 

And push current branch (we are on ti-linux-3.14.y after checkout)

git push -u gitlab

repo clean and repack

git reflog expire --expire=1.minute refs/heads/master
git fsck --unreachable      
git prune                   
git gc                

Debug

GIT_TRACE=1 git clone ...
GIT_CURL_VERBOSE=1 GIT_TRACE=1 git clone ...