meta data for this page
  •  

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
git:start [2015/05/20 11:07] niziakgit:start [2023/05/30 10:29] (current) niziak
Line 1: Line 1:
-GIT PAGE+====== GIT ====== 
 + 
 +====== Preparation ====== 
 + 
 +=== git-email === 
 +<code bash> 
 +sudo apt-get install git-email 
 +git config sendemail.signedoffcc false 
 +git config sendemail.suppressfrom true 
 +</code> 
 + 
 +=== replace github's git: links === 
 +NOTE: Github was disabled git protocol. So only ''https:'' or ssh ''git@'' is valid. 
 + 
 +<code bash> 
 +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:// 
 +</code> 
 + 
 +Keywords: git protocol, ''git:'' protocol 
 + 
 +=== replace github https links === 
 +<code bash>git config --global url.git@github.com:.insteadOf https://github.com/</code> 
 + 
 +====== Import HG (mercurial) repo ====== 
 +<code bash> 
 +sudo apt-get install hg-fast-export 
 +git init 
 +hg-fast-export -r . 
 +</code> 
 + 
 + 
 +====== Usage ====== 
 + 
 +==== fetch moved tags ==== 
 +<code bash>git fetch origin --tags --force</code> 
 + 
 +==== Undo a commit ==== 
 +Undo a commit and redo 
 + 
 +<code bash> 
 +$ git commit ...               
 +$ git reset --soft HEAD~1      
 +<< edit files as necessary >>  
 +$ git add ....                 
 +$ git commit -c ORIG_HEAD      
 +</code> 
  
 ==== Local copy of one branch from public repo ==== ==== Local copy of one branch from public repo ====
 +<code bash>
 git remote add ti git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git 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 remote add tilocal /home/user/mirrors/ti-linux-kernel
 git fetch ti refs/heads/ti-linux-3.14.y  git fetch ti refs/heads/ti-linux-3.14.y 
 git checkout ti-linux-3.14.y git checkout ti-linux-3.14.y
 +</code>
  
 Now we have latest version from ti-linux-3.14.y branch. Now we have latest version from ti-linux-3.14.y branch.
 Add our local GitLab server Add our local GitLab server
  
-git remote add gitlab ssh://path...+<code bash>git remote add gitlab ssh://path... </code>
  
 And push current branch (we are on ti-linux-3.14.y after checkout) And push current branch (we are on ti-linux-3.14.y after checkout)
-git push -u gitlab+<code bash>git push -u gitlab</code> 
 + 
 +==== repo clean and repack ==== 
 +<code bash> 
 +git reflog expire --expire=1.minute refs/heads/master 
 +git fsck --unreachable       
 +git prune                    
 +git gc                 
 +</code> 
 + 
 +====== Debug ====== 
 +<code bash> 
 +GIT_TRACE=1 git clone ... 
 +GIT_CURL_VERBOSE=1 GIT_TRACE=1 git clone ... 
 +</code>