Posts

Showing posts with the label tips

Git tips, tricks and some explanations

Image
Git tips, tricks and some explanations Полезные встроенные графические инструменты (для винды): gitk - Графический просмотрщик для коммитов git gui - Чё-то наподобие среды для GIT (ну GUI есть гуй :-) Создаём Псевдонимы: $ git config --global alias. ch checkout $ git config --global alias. br branch $ git config --global alias. co commit $ git config --global alias. st status $ git config --global alias. visual '!gitk'  Пример использования: $ git st Чтобы создать ветку и сразу же перейти на неё, вы можете выполнить команду: $ git checkout -b имя_ветки Допустим, вы разобрались с проблемой  hotfix   и готовы объединить эту ветку и свой master . Чтобы сделать это, мы сольём ветку имя_ветки в ветку master . Всё, что вам нужно сделать, — перейти на ту ветку, в которую вы хотите слить свои изменения, и выполнить команду git merge : $ git checkout master (переход в master) $ git merge имя_ветки (сливание[объединение]) Вы можете удалить ветку с по

Linux tips and tricks for web-dev

Image
Linux tips and tricks for web-dev's show file/folders rights in drxr & 777 formats :     stat -c '%A %a %n' /<your_folder>/ monitor changing file :   tail -f -n 10 var/log/dev.log download big file with cURL :   curl --location 'https://<your_url>' \ --header 'Authorization: Token <token>' -o file.name curl response with the following redirects : curl -iL --max-redirs 1 http://example.com monitor folder recursively for changes : inotifywait -m -e create,delete -r /<your_folder>       6. removing all files in the folder except some needed                        in zsh :         setopt extended_glob         rm -rv -- ^(.git|.idea)(D) -r:   Recursively delete directories and their contents. -v : Display what is being deleted. -- :  Denotes the end of options to prevent issues with filenames starting with hyphens. ^(pattern) : Exclude files and directories that match the given pattern. (.git|.idea) : List of patterns to exclude (in th

Docker tips & tricks

Image
Docker tips & tricks 1. one-line command for build & run container at once      docker-compose up -d --build -d means in background (daemon)  2.  speedup docker builds 3.  Rebuild containers using docker compose when dockerfile changes           docker-compose up --force-recreate 4.   If I have a bad deploy this may help      docker-compose build --no-cache 5. R emove all images      docker-compose down --rmi ("local"|"all") 6. Automatically update services with file watch  in Docker Compose ( experimental,  Docker Desktop 4.24.0 said that this feature is now open for all )             docker-compos up --watch 7. Removing containers with the data ( be careful, you will lose all your data for the containers that are in docker-compose )     docker-compose down -v 8. Doker 3.5+: network section changes instead  networks : default : external : name : ddev_default should be  networks : default : name : ddev_default external :

Composer life hacks

Image
Composer life hacks Switching between composer 1 & 2: composer  self-update --1   --> switch to composer 1 composer  self-update --2   -->  switch to composer 2 If you only want to install, upgrade or remove one dependency, you can explicitly list it as an argument: php composer.phar update monolog/monolog [...] composer dump-env dev - will generate .env.local.php (which you can change with your needs) Installing tools globally: php composer.phar global require friendsofphp/php-cs-fixer or just  composer global require friendsofphp/php-cs-fixer

Windows Tips: shortcuts and aliases

Image
Windows tips: shortcuts and aliases https://stackoverflow.com/questions/20530996/aliases-in-windows-command-prompt - interesting approaches how to add temporary environment variables and aliases Shorts (aliases) for some exe's apps if you already have these apps: code - runs Visual Studio Code text editor code .   - run it with full content current directory as a context subl - runs Sublime Text 2|3 text editor subl  .  - the same as for VS code [ cmd.exe ] - get aliases doskey /MACROS:ALL [ powershell.exe or pwsh.exe ]  - get aliases https://mcpmag.com/articles/2014/06/10/exe-alias-in-powershell.aspx - here you can read also how to create aliases alias - powershell internal aliases get-alias | where {$_.ReferencedCommand -match "exe"} | format-table Name,Definition -autosize  - this command will show you external .EXE apps aliases  [ bash.exe or git-bash.exe ]  - get aliases alias