The list of Git commands that tackle most everyday routines. Branches The commands to work with local and remote branches. Pull and rebase
|
git pull --rebase=i origin feature-1 |
Commit difference between branches
|
git log origin/develop..origin/master --oneline |
Overwrite remote branch with local branch
|
git checkout local-feature-branch git push -f origin HEAD:remote-feature-branch |
Useful when it’s need to do restore from local branch. Commits count between branches
|
git rev-list --left-right --count origin/branch-1...origin/branch-2 | cut -f1 |
–no-merges parameter allow to…
Read More
Copy a folder
|
cp -avr /home/cool_site_folder /var/www/cool_site_new_folder_name |
What port is used?
|
netstat -tulpn | grep php-fpm |
Find and delete files greater than a given size
|
find . -size +1M -exec rm -i {} \; |
Find out directories using disk space Find a file
|
sudo find / -name 'php.ini' |
Sorting ls command output by file size
to reverse order use -r option. Archive directory
|
tar -zcvf my-dir.tar.gz /home/user/my-dir |
Copy files from remote to local with Rsync
|
rsync -razP user@remote-server.com:~/home/remote-user/file.cpp /home/local-user/ |
…
Read More
If you have multiple versions of PHP and you want to change PHP version in shell then run the following command:
This will give you a list of all PHP versions installed:
|
php: /usr/bin/php /etc/php.ini /etc/php.d /usr/lib64/php /usr/include/php /usr/share/php |
Find version that you need (i.e. /usr/bin/php71). Then open .bashrc (or .bash_profile) and add the following line to the end of…
Read More
Hands-on recipes how to quick tackle the problems.
Sometimes it’s easy to have ready-to-use recipes than scrolling stackoverflow or google.
Add popular recipes to favorites and use it as handbook.