2024-07-07

git

  • git stash: recording the state of working directory with changes to the working directory,but want to go back to the clean working directory, this saves local changes and reverts the working directory to the HEAD.

For example your present working directory is branch1 and made a few local changes and these local changes has to be in another new branch, branch2

  1. git stash: stash the local changes
  2. git stash branch branchName: creates a new branch with the branch name as <branchName> and the local changes which were stashed are moved to the new branch.
  3. git stash pop: to pop out the stashed changes in the new branch created.
  • git notes: is a feature to add extra information to a commit without the need to changing the commit itself.
adding git notes feature to latest commit
$ git notes add -m "testing notes feature for the latest commit"

$ git log
commit e2d42c8b5104bb71b2697e723e23eb161684fbe4 (HEAD -> master, origin/master, origin/HEAD)
Author: Vinay Keshava <vinaykeshava@email.com>
Date:   Wed Jul 3 17:54:57 2024 +0530

    wily:July 3rd

Notes:
    testing notes feature for the latest commit
  • git notes add -m "<message>": adding notes to the lastest commit
  • git notes add -m "<message>" <commit-id>": adding a note to a particular commit
  • git notes append -m "<message>" <commit-id>: appending a note to existing commit
  • git notes remove <commit-id>: removing notes for a particular id.

Vim Learnings

  • CTRL-G: displays the file postion and other details.
  • gg: moves the cursor to the top of the file.
  • G: moves the cursor to bottom of the file.

Substitute command

  • s/<oldphrase>/<newphrase>: replaces the single occurence of old phrase with the new phrase.
  • s/<oldphrase>/<newphrase>/g : to find and replace every occurennce.
  • s/<oldphrase>/<newphrase>/gc : to find and replace every occurennce of the phrase with a prompt to be replaced or not.

/bin/bash

BASH stands for ‘Bourne Again SHell’, shell programming uses other common shells like sh,csh etc. Shell programming can be achieved by directly executing commands at the shell prompt.

Shebang: #!/bin/bash telling the operating system which interpreter to be used to parse the rest of the file.

Ansible

Ansible is a open source tool, that automates application deployment, cloud provisioning, intra-service orchestration.