How you can change the server URL for GIT repository

Assume that your remote origin (repository server URL) is:  and you want to replace it with .

Command to check your current origins:

You will be able to see the origins for both fetch and push operations:

Command to change the GIT repository origin:

That’s it. You now successfully relocated your repository pointing to the new server.

How to restore the deleted local file from GIT repository

It is very simple to get the locally deleted file in a git repository. Make sure that you are not committed any changes.

Suppose you deleted the file: myfolder/my_deleted_file.txt  accidentally and you want to retrieve the file from the server.

Execute the following command:

That’s it. Your file is now restored to the folder.

How to create a new branch in the GIT file repository

It is a common practice that you have to create a new branch for developing the new sprint (agile based development) or a new development phase. With GIT repository, it is very easy to create and work with new branch as you go.

Note: For windows developers, use CygWin for the command console. This will help you to create a virtual Linux like environment in windows system. Continue reading How to create a new branch in the GIT file repository