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 [2016/09/07 10:34] niziakgit:start [2025/08/05 16:16] (current) niziak
Line 1: Line 1:
-GIT PAGE+====== GIT ====== 
 ====== Preparation ====== ====== Preparation ======
 +
 +===== bash completion =====
 +
 +[[https://git-scm.com/book/en/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Bash|A1.6 Appendix A: Git in Other Environments - Git in Bash]]
 +
 +Package ''git'' contains:
 +<code>
 +/etc/bash_completion.d/git-prompt
 +/usr/share/bash-completion/completions/git
 +/usr/share/bash-completion/completions/gitk
 +</code>
 +
 +<file bash ~/.bashrc>
 +. /usr/share/bash-completion/completions/git
 +. /usr/lib/git-core/git-sh-prompt
 +
 +if [ "$color_prompt" = yes ]; then
 +#   PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
 +    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(__git_ps1 "(%s)")\[\033[00m\]\$ '
 +else
 +#   PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
 +    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\'$(__git_ps1 "(%s)")'\$ '
 +fi
 +</file>
 +
 +
 +
 === git-email === === git-email ===
 <code bash> <code bash>
Line 7: Line 35:
 git config sendemail.suppressfrom true git config sendemail.suppressfrom true
 </code> </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>
 +
 +
 +=== replace own links and points to github ===
 +<code bash>
 +# Remove replacement:
 +git config --unset url."git@github.com:foo".insteadOf || true
 +
 +# Add replacement:
 +git config url."git@github.com:foo".insteadOf "git@gitlab.grinndev.ovh:foo/yocto"
 +</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 ====
Line 19: Line 84:
 </code> </code>
  
-==== Usage ==== 
  
 ==== Local copy of one branch from public repo ==== ==== Local copy of one branch from public repo ====
Line 46: Line 110:
  
 ====== Debug ====== ====== Debug ======
 +
 +[[https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables#_debugging|Debugging]]
 +
 +  * ''GIT_TRACE_PERFORMANCE=1'': enables tracing of performance data, showing how long each particular git invocation takes.
 +  * ''GIT_TRACE_SETUP=1'': enables tracing of what git is discovering about the repository and environment it’s interacting with.
 +  * ''GIT_TRACE_PACKET=1'': enables packet-level tracing for network operations.
 +  * ''GIT_CURL_VERBOSE=1'': enables curl’s verbose output, which may include credentials.
 +
 <code bash> <code bash>
 GIT_TRACE=1 git clone ... GIT_TRACE=1 git clone ...
 GIT_CURL_VERBOSE=1 GIT_TRACE=1 git clone ... GIT_CURL_VERBOSE=1 GIT_TRACE=1 git clone ...
 +GIT_TRACE_PACKET=1 GIT_TRACE=2 GIT_CURL_VERBOSE=1 git clone https://...
 +
 +GIT_SSH_COMMAND="ssh -vvv" git clone <git@url>
 </code> </code>