What are the porcelain commands?
Description
There are 145 commands in git in total, 82 porcelain commands and 63 plumbing commands.
- 44 main commands
add
,commit
,push
, ...- 11 manipulators
config
,reflog
,replace
, ...- 17 interrogators
blame
,fsck
,rerere
, ...- 10 interactors
send-email
,p4
,svn
, ...
Resources
What are the plumbing commands?
Description
There are 145 commands in git in total, 82 porcelain commands and 63 plumbing commands.
- 19 manipulators
apply
,commit-tree
,update-ref
, ...- 21 interrogators
cat-file
,for-each-ref
, ...- 5 syncing
fetch-pack
,send-pack
, ...- 18 internal
check-attr
,sh-i18n
, ...
Resources
Conditionally use different git config file based on your project directory?
Description
A sample use case is to use different git config when you are in work and open source software directory.
[includeIf "gitdir:~/projects/work/"] path = ~/projects/work/.gitconfig [includeIf "gitdir:~/projects/oss/"] path = ~/projects/oss/.gitconfig
Resources
Configure git to sign commits by ssh?
Description
git config --global gpg.format ssh git config --global user.signingkey ~/.ssh/id_rsa.pub git commit -S
You can see that your signature is appended to your commit files:
git cat-file -p HEAD
Resources
Use shell command as a git alias?
Description
git config --global alias.bb better-branch.sh
Resources
List available branches?
Description
Command
branch
will list branches each in a row.git branchNewer
--column
option will put branches on columns to avoid using a pager.git branch --column
Resources
Enable column view of branches by default?
Description
git config --global column.ui auto git config --global branch.sort -committerdate
Resources
What options can be used to stash all ignored and untracked files along unstaged files?
Description
git stash --allIt is suggested by the community to have this alias:
git config --global alias.staash 'stash --all'
Resources
Log only a part of a file?
Description
git log -L 25,34:src/main.cpp
Resources
Search through the git history for a string that was removed?
Description
git log -S regex_match -p
Resources
What is a safer mechanism to force push commits?
Description
Forcing push will remove all the changes that others have made since that last common change you have made. The option
--force-with-lease
will only pushes the rebased changes when there is no other changes pushed by other since your last common changes.git push --force-with-lease
Resources
Push your sign along with pushing changes?
Description
This feature is not supported by GitHub or GitLab.
git push --signed
Resources
How cloning can become faster?
Description
By partially cloning the repository and skipping the blobs:
git clone --filter=blob:none git clone --filter=true:0
Resources
What is the downside of partial cloning?
Description
Graphs and blames will download the rest of required data on demand to generate results which will take time.
git clone --filter=blob:none git blame lib/nlattr.c
Resources
List remote refs?
Description
git ls-remote
Resources
Set fetch remotes to a project?
Description
git config remote.origin.fetch '+refs/pull/*:refs/remotes/origin/pull/*' git fetch
Resources
Blame only a part of a file?
Description
git blame -L 25,34:src/main.cpp
Resources
Ignore white spaces in blame?
Description
git blame -w
Resources
Detect who moved or copied in the same commit in blame?
Description
git blame -w -C
Resources
Detect who created or changed the file in blame?
Description
git blame -w -C -C
Resources
Detect any commit that affects a line of code in blame?
Description
git blame -w -C -C -C -L 24,35:src/main.cpp
Resources
What is a reflog?
Description
Reflog is a log of your references.
Whenever the
HEAD
is pointing at something, it has a log of that in reflog.git reflog
Resources
Differentiate two commits by line?
Description
git diff
Resources
Differentiate two commits by word?
Description
git diff --word-diff
Resources
What is the advantage of using Reused Recorded Resolution?
Description
This feature records how you had a conflict and how you fixed it, so that it will solve your conflicts automatically next time you hit similar conflict.
Resources
Enable Reused Recorded Resolution feature?
Description
git config --global rerere.enabled true
Resources
What does maitainance start
command do?
Description
It adds following lines to
.git/config
file:[maintainance] auto = false strategy = incremental
Resources
What is the use case of maintainance command?
Description
By running maintainance, git starts a cron job running tasks reguarly.
A few of these tasks are:
gc: disabled
commit-graph: hourly
prefetch: hourly
loose-objects: daily
incremental-repack: daily
pack-refs: none
Resources
What is the use case of commit graph command?
Description
Commit graph creates a graph of commits stored separately on disk and makes git commands very faster to run for large projects.
git commit-graph write
Resources
How often should we run commit graph command?
Description
This command should be done manually once, and then let git update the graph over next fetches.
git config --global fetch.writecommitgraph true
Resources
What mechanism can be used to increase the status command performance on big repositories?
Description
Launches a daemon that looks at the filesystem and watches for inode events and updates the cache in memory and tells git which files was changed every time git tries to stat the files.
git config core.untrackedcache true git config core.fsmonitor trueFirst status command launches this mechanism, so it would make more time to finish, but subsequent calls will be fast.
Resources
What is the impact of using multipack index mechanism?
Description
Resources
References
Clone with no checkout?
Description
git sparse-checkout
Resources