--
ChristianKahra - 2022-08-03
Git
How effectively delete a git submodule
https://gist.github.com/myusuf3/7f645819ded92bda6677
To remove a submodule you need to:
* Delete the relevant section from the .gitmodules file.
* Stage the .gitmodules changes git add .gitmodules
* Delete the relevant section from .git/config.
* Run git rm --cached path_to_submodule (no trailing slash).
* Run rm -rf .git/modules/path_to_submodule (no trailing slash).
* Commit git commit -m "Removed submodule "
* Delete the now untracked submodule files rm -rf path_to_submodule
How to track all remote branches:
git branch -r | grep -v '\->' | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" | while read remote; do git branch --track "${remote#origin/}" "$remote"; done(sed command removes color escape sequences. Could also be achieved by using git branch -r --no-color)
How to abort a git commit when writing the commit message (using vi):
Exit vi with an error code.
:cq
Git will abort then the commit
Find
Find files in subdirectories (e.g. all xci files) and copy them with the relative path to an other location
find . -name '*.xci' | xargs -t -n1 -I SUB cp --parents SUB destination_path/
_xargs_ arguments
* -t: print the command to stdout, which will be executed (optional for verbosity)
* -n1: execute the copy command for each file separately (all at the same time would also work)
* -I SUB: use the string "SUB" as placeholder -> will be replaced by the result of the
find command
_cp_ arguments
* -- parents: copy the file with the relative sub-directory structure to the destination
ssh-agent
eval `ssh-agent`
ssh-add ~/.ssh/id_rsa
Vivado
copy_run -name synth_production_2 [get_runs synth_production]
copy_run -name impl_production_2 [get_runs impl_production] -parent_run synth_production_2