How to cherry pick a file from another branch in to current branch?
git checkout <other_branch_name> <files/to/grab in/list/separated/by/spaces> -p
example:
git checkout mybranch config/important.yml app/models/important.rb -p
How to list branches by creation date?
git for-each-ref --sort='-authordate'
What is the difference between git fetch
and git pull
?
-
git fetch
pull only the meta data from remote. Good to know without actually pulling data locally. -
git pull
pulls the difference from remote. So first do agit fetch
understand the difference and then do the pull only when ready.
How to get the status of all the repositories in a directory?
for d in */; do
if [ -d "$d/.git" ]; then
echo "$d"
cd "$d"
git status
cd ..
fi
done
Top comments (1)
a tip for you, run this on your terminal:
$ man giteveryday