1.7 KiB
1.7 KiB
FAQ
Scripting
Search all duplicate file recursively in given directory
find . -type f -printf '%p/ %f\n' | sort -k2 | uniq -f1 --all-repeated=separate
Search all duplicate directory recursively in given directory
find . -type d -printf '%p/ %f\n' | sort -k2 | uniq -f1 --all-repeated=separate
Networking
Show all open port
sudo lsof -i -P -n | grep LISTEN
or
sudo netstat -lpnt | grep LISTEN
or
sudo ss -lpnt | grep LISTEN
Git
Unshallow git
By example, the repo Odoo use a depth clone. If you need all the clone repo, use this command on right directory:
git fetch REMOTE --unshallow
Amend several commits in Git to change author
git rebase -i HEAD~4 -x "git commit --amend --author 'Author Name <author.name@mail.com>' --no-edit"
Cherry-pick a merged commit with conflict
git cherry-pick -m 1 --strategy-option theirs HASH
git-repo
error.GitError fatal bad revision
Example:
error.GitError: manifests rev-list (u'^2736dfd46e8a30cf59a9cd6e93d9e56e87021f2a', 'HEAD', '--'): fatal: bad revision 'HEAD'
Did you modify files in .repo?
To reset files from your branch into .repo:
cd .repo/manifests
git branch -av
> remotes/m/rel/8953/zd552kl/7.1.1-11.40.208 -> origin/rel/8953/zd552kl/7.1.1-11.40.208
> remotes/origin/dev/ze550kl/asus/5.0.0-20150208 11a37fe set dev/ze550kl/asus/5.0.0-20150208
> remotes/origin/rel/8953/zd552kl/7.1.1-11.40.208 2736dfd Remove opencv3 from the manifest
# To reset the "remotes/origin" use the same as "remotes/m"
git reset --hard REF_OF_REMOTES/m
> git reset --hard remotes/origin/rel/8953/zd552kl/7.1.1-11.40.208