git clone --depth 1 --single-branch --branch v5.10.52 \ git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-5.10.52
git status
git status -s
git cherry-pick -n -Xpatience <commit>
<last_good_commit>
, and keep all changes in worktree/index: git reset --soft <last_good_commit>
<last_good_commit>
up to HEAD
: git reset --hard <last_good_commit>
; if pushed in the past then do in addition: git push -f origin <branch>
git merge --no-commit master
git checkout master;git pull;git checkout <branch>; git rebase master
-i
) provides better control sometimes.git rebase -p
git rebase -i HEAD~3
git branch -r
git remote show origin
git checkout -b <branchname>
git stash branch <branchname>
git push origin <branchname>
git push --tags
git branch --set-upstream-to=origin/<any> <branchname>
git rev-parse --abbrev-ref HEAD
; or with a Bash alias: git_branch_name() { local name="$(git rev-parse --abbrev-ref HEAD)" echo "$name" } alias gbn=git_branch_name
git log --first-parent --pretty=oneline $(gbb)~..HEAD
; or: git show-branch --current --sha1-name
git diff --name-status $(gbb)~ HEAD --
git log --graph --oneline --all
git reflog
git tag -n
git tag -a v0.5 -m “release 0.5”
git am
:2) git format-patch -s -M --stat --summary --cover-letter -o mboxdir origin/devel..
patch
: diff -Naur file1 file2 > patchfile
(-N »treat absent files as empty, -r »recursive, -a »treat all files as text, -u »unified context)git difftool --tool=ediff file
git format-patch
/ git am
against git diff
/ git apply
, because of it's better conflict resolution capabilities.
git format-patch
: git am --reject mboxdir/mboxfile
git send-email --no-signed-off-cc --to="user1 <user1@dummy.com>" --cc="user2 <user2@dummy.com>" mboxdir/mboxfile/
patchfile
with patch
: patch -p1 < patchfile
git remote -v
git config remote.origin.url ssh://<user>@<server>:<port>/<repo>
SSL certificate problem: unable to get local issuer certificate
. This problem can be solved by suppressing the issuer certificate validation with: git config --global http.sslVerify false
/etc/gitconfig
: system-wide Git configuration file~/.gitignore
: ignored files (see core.excludesfile
in file ~/.gitconfig
below)~/.gitmessage.txt
: commit template (see commit.template
in file ~/.gitconfig
below)~/.gitconfig
: users global Git configuration:# -*- mode: conf -*- # # Copyright (C) 2018 Ralf Hoppe <ralf@dfcgen.de> # [user] name = Ralf Hoppe email = ralf.hoppe@ieee.org [core] editor = emacs excludesfile = ~/.gitignore [pager] branch = false [color] diff = auto status = auto branch = auto interactive = auto status = auto diff = auto [credential] helper = cache [commit] template = ~/.gitmessage.txt [log] abbrevCommit = true [sendemail] # smtpserver = ??? from = Ralf Hoppe <ralf.hoppe@ieee.org> envelopesender = ralf.hoppe@ieee.org suppressfrom = true # do not add From: address to the cc: list confirm = auto # confirm before sending on automatic adding of addresses thread = false # no threading by git-send-email (see git-format-patch) [diff] tool = ediff guitool = ediff [difftool] prompt = false # do not prompt before launch [difftool.ediff] cmd = ediff.sh $LOCAL $REMOTE [merge] tool = ediff [mergetool] keepBackup = false [mergetool.ediff] cmd = ediff.sh $LOCAL $REMOTE $MERGED $BASE keepBackup = false trustExitCode = true [pull] rebase = merges [push] # "git push" without any refspec will push the current branch out to # the same name at the remote repository only when it is set to track # the branch with the same name over there default = simple [format] signoff = true # add Signed-off-by: line to the commit message thread = shallow # do threading in git-format-patch
--no-prefix
if applied with git apply
.git reflog show
in conjunction with git reset
.