2020-07-05 22:38:14 -04:00
|
|
|
# FAQ
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2022-01-24 14:03:38 -05:00
|
|
|
## Scripting
|
|
|
|
|
|
|
|
|
|
### Search all duplicate file recursively in given directory
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
find . -type f -printf '%p/ %f\n' | sort -k2 | uniq -f1 --all-repeated=separate
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Search all duplicate directory recursively in given directory
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
find . -type d -printf '%p/ %f\n' | sort -k2 | uniq -f1 --all-repeated=separate
|
|
|
|
|
```
|
|
|
|
|
|
2021-01-20 06:23:44 -05:00
|
|
|
## Networking
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-01-20 06:23:44 -05:00
|
|
|
Show all open port
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-01-20 06:23:44 -05:00
|
|
|
```bash
|
|
|
|
|
sudo lsof -i -P -n | grep LISTEN
|
|
|
|
|
```
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-01-21 01:52:54 -05:00
|
|
|
or
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-01-21 01:52:54 -05:00
|
|
|
```bash
|
|
|
|
|
sudo netstat -lpnt | grep LISTEN
|
|
|
|
|
```
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-01-21 01:52:54 -05:00
|
|
|
or
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-01-21 01:52:54 -05:00
|
|
|
```bash
|
|
|
|
|
sudo ss -lpnt | grep LISTEN
|
|
|
|
|
```
|
2021-01-20 06:23:44 -05:00
|
|
|
|
2022-02-23 04:03:15 -05:00
|
|
|
## Git
|
|
|
|
|
|
2022-03-04 17:39:00 -05:00
|
|
|
### Configuration
|
|
|
|
|
|
|
|
|
|
Prefer to use Vim when editing?
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
git config --global core.editor "vim"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Prefer to use Meld when resolving conflit?
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
git config --global merge.tool meld
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Prefer to us Meld to show difference?
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
git config --global diff.tool meld
|
|
|
|
|
git config --global difftool.prompt false
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Retroactively applying format code to existing branches
|
|
|
|
|
|
|
|
|
|
Adapt this command to your situation, this is an example:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
git rebase --strategy-option=theirs --exec 'cd ../../ && ./script/maintenance/black.sh ./addons/ERPLibre_erplibre_theme_addons/website_snippet_all/ && cd - && git add --all && git commit --amend --no-edit' HEAD~47
|
|
|
|
|
```
|
|
|
|
|
|
2022-02-23 04:03:15 -05:00
|
|
|
### Unshallow git
|
|
|
|
|
|
|
|
|
|
By example, the repo Odoo use a depth clone. If you need all the clone repo, use this command on right directory:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
git fetch REMOTE --unshallow
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Amend several commits in Git to change author
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
git cherry-pick -m 1 --strategy-option theirs HASH
|
|
|
|
|
```
|
|
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
## git-repo
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
### error.GitError fatal bad revision
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
Example:
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
```
|
|
|
|
|
error.GitError: manifests rev-list (u'^2736dfd46e8a30cf59a9cd6e93d9e56e87021f2a', 'HEAD', '--'): fatal: bad revision 'HEAD'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Did you modify files in .repo?
|
|
|
|
|
|
2020-09-30 20:49:35 -04:00
|
|
|
To reset files from your branch into .repo:
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
```bash
|
|
|
|
|
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
|
2021-07-20 20:14:24 -04:00
|
|
|
```
|