Categories
Tips

How To Delete a Local and Remote Git Branch

To delete a local branch in Git.
git branch -D <branch_name>

To delete a remote branch in Git.
git push origin --delete <branch_name>

Categories
Tips

Integrate node.js command prompt in Visual Studio Code

Save the below line under User Settings in Visual Studio Code. Reload the editor. This will enable node.js terminal inside the editor.

"terminal.integrated.shellArgs.windows": [
    "C:\\Windows\\System32\\cmd.exe /k nodevars.bat"
 ],
Categories
Tips

How To Rename a Local and Remote Git Branch

Follow the steps below to rename a Local and Remote Git Branch:

Start by switching to the local branch which you want to rename.
git checkout <old_name>

Rename the local branch by typing the below.
git branch -m <new_name>

At this point, you have renamed the local branch. If you’ve already pushed the <old_name> branch to the remote repository, perform the next steps to rename the remote branch.

Push the <new_name> local branch and reset the upstream branch:
git push origin -u <new_name>

Delete the <old_name> remote branch:
git push origin --delete <old_name>

That’s it. You have successfully renamed the local and remote Git branch.

Categories
Tips

npm unset a registry

A registry is set using below command.
npm set registry http://www.thelittletechie.com:8080

To unset a registry type the below command in command prompt.
npm config edit

This opens a file in editor with the file name .npmrc which is the config file of npm.

Remove the registry line which you have set and save the file.
registry=http://www.thelittletechie.com:8080/

That’s it you have now removed the set registry.

Categories
Tips

Deleting longer path using rimraf

The npm packages gets installed locally in node_modules folder. On trying to deleted the folder you will get a message saying “The source file name(s) are larger than is supported by the file system.

Try moving to a location which has a shorter path name, or try renaming to shorter name(s) before attempting this operation

This happens because of the nesting of folders.

To delete this successfully you can use RimRaf.

Install RimRaf globally in your system.
npm install -g rimraf

Now go the directory for which you want to remove the node_modules in command prompt and run the below command.
rimraf node_modules

You can do this for deleting any longer folder path.

Categories
Tips

How to change the color of address bar in mobile browser to match your website

Nowadays most of the websites are responsive websites. This makes your site looks great on mobile devices. However, it still looks and feels like a website. Matching the color of address bar to your website, gives it a native app-like feel. This improves user experience.

Simply add the below meta tag to head section of your page.

<!-- Chrome, Firefox OS, Opera-->
<meta name="theme-color" content="#4285f4">
<!-- Windows Phone -->
<meta name="msapplication-navbutton-color" content="#4285f4">
<!-- iOS Safari -->
<meta name="apple-mobile-web-app-status-bar-style" content="#4285f4">

The content field has the hex code for the color you want to use as theme color.