December 28, 2021

git alias to pull forward only

 Simple git alias that does pull --ff-only. It is possible to configure git pull to do --ff-only by default - https://blog.sffc.xyz/post/185195398930/why-you-should-use-git-pull-ff-only-git-is-a
but I prefer to have default settings for commands to have fine-grained control over the operations.

Open .gitconfig (usually it is in c:/users/YOUR-USER/.gitconfig) and add an alias:

[alias]
up = !git pull --ff-only

December 16, 2021

git alias to pull another branch and checkout it

 Open .gitconfig (usually it is in c:/users/YOUR-USER/.gitconfig) and add an alias:

[alias]
cb = !git fetch origin $1:$1 && git checkout

Then instead of doing

> git checkout master
> git pull

You can do 

> git cb master

And avoid double changes that cause reload in IDE.


December 01, 2021

Simplify folder navigation in windows terminal powershell


Open settings json file in windows terminal (ctrl+shift+,), find "actions" json array, add two commands (don't forget about preceding coma):

        {
            "command":
            {
                "action": "sendInput",
                "input": "cd ..\r"
            },
            "keys": "alt+up"
        },
        {
            "command":
            {
                "action": "sendInput",
                "input": "cd \u0000"
            },
            "keys": "alt+down"
        }

From now on pressing Alt+Up will go one level up (like in Windows Explorer) and pressing Alt+Down will bring powershell hint for switching the directory:






The trick here is to use \u0000 which is a terminal equivalent of pressing Ctrl+Space. It is applicable only to powershell, since there is no directory browsing feature in a regular cmd.