Git RemoteIn Git, the term remote is concerned with the remote repository. It is a shared repository that all team members use to exchange their changes. A remote repository is stored on a code hosting service like an internal server, GitHub, Subversion, and more. In the case of a local repository, a remote typically does not provide a file tree of the project's current state; as an alternative, it only consists of the .git versioning data. The developers can perform many operations with the remote server. These operations can be a clone, fetch, push, pull, and more. Consider the below image: ![]() Check your RemoteTo check the configuration of the remote server, run the git remote command. The git remote command allows accessing the connection between remote and local. If you want to see the original existence of your cloned repository, use the git remote command. It can be used as: Syntax: Output: ![]() The given command is providing the remote name as the origin. Origin is the default name for the remote server, which is given by Git. Git remote -v: Git remote supports a specific option -v to show the URLs that Git has stored as a short name. These short names are used during the reading and write operation. Here, -v stands for verbose. We can use --verbose in place of -v. It is used as: Syntax: Or Output: ![]() The above output is providing available remote connections. If a repository contains more than one remote connection, this command will list them all. Git Remote AddWhen we fetch a repository implicitly, git adds a remote for the repository. Also, we can explicitly add a remote for a repository. We can add a remote as a shot nickname or short name. To add remote as a short name, follow the below command: Syntax: Output: ![]() In the above output, I have added a remote repository with an existing repository as a short name "hd". Now, you can use "hd" on the command line in place of the whole URL. For example, you want to pull the repository, consider below output: ![]() I have pulled a repository using its short name instead of its remote URL. Now, the repository master branch can be accessed through a short name. Fetching and Pulling Remote BranchYou can fetch and pull data from the remote repository. The fetch and pull command goes out to that remote server, and fetch all the data from that remote project that you don't have yet. These commands let us fetch the references to all the branches from that remote. To fetch the data from your remote projects, run the below command: To clone the remote repository from your remote projects, run the below command: When we clone a repository, the remote repository is added by a default name "origin." So, mostly, the command is used as git fetch origin. The git fetch origin fetches the updates that have been made to the remote server since you cloned it. The git fetch command only downloads the data to the local repository; it doesn't merge or modify the data until you don't operate. You have to merge it manually into your repository when you want. To pull the repository, run the below command: The git pull command automatically fetches and then merges the remote data into your current branch. Pulling is an easier and comfortable workflow than fetching. Because the git clone command sets up your local master branch to track the remote master branch on the server you cloned. Pushing to Remote BranchIf you want to share your project, you have to push it upstream. The git push command is used to share a project or send updates to the remote server. It is used as: To update the main branch of the project, use the below command: It is a special command-line utility that specifies the remote branch and directory. When you have multiple branches on a remote server, then this command assists you to specify your main branch and repository. Generally, the term origin stands for the remote repository, and master is considered as the main branch. So, the entire statement "git push origin master" pushed the local content on the master branch of the remote location. Git Remove RemoteYou can remove a remote connection from a repository. To remove a connection, perform the git remote command with remove or rm option. It can be done as: Syntax: Or Consider the below example: Suppose you are connected with a default remote server "origin." To check the remote verbosely, perform the below command: Output: ![]() The above output will list the available remote server. Now, perform the remove operation as mentioned above. Consider the below output: ![]() In the above output, I have removed remote server "origin" from my repository. Git Remote RenameGit allows renaming the remote server name so that you can use a short name in place of the remote server name. Below command is used to rename the remote server: Syntax: Output: ![]() In the above output, I have renamed my default server name origin to hd. Now, I can operate using this name in place of origin. Consider the below output: ![]() In the above output, I have pulled the remote repository using the server name hd. But, when I am using the old server name, it is throwing an error with the message "'origin' does not appear to be a git repository." It means Git is not identifying the old name, so all the operations will be performed by a new name. Git Show RemoteTo see additional information about a particular remote, use the git remote command along with show sub-command. It is used as: Syntax: It will result in information about the remote server. It contains a list of branches related to the remote and also the endpoints attached for fetching and pushing. Output: ![]() The above output is listing the URLs for the remote repository as well as the tracking branch information. This information will be helpful in various cases. Git Change Remote (Changing a Remote's URL)We can change the URL of a remote repository. The git remote set command is used to change the URL of the repository. It changes an existing remote repository URL. Git Remote Set: We can change the remote URL simply by using the git remote set command. Suppose we want to make a unique name for our project to specify it. Git allows us to do so. It is a simple process. To change the remote URL, use the below command: The remote set-url command takes two types of arguments. The first one is Consider the below image: ![]() In the above output, I have changed my existing repository URL as https://github.com/URLChanged from https://github.com/ImDwivedi1/GitExample2. It can be understood by my URL name that I have changed this. To check the latest URL, perform the below command: Next TopicGit Branch
|
Python tutorial provides basic and advanced concepts of Python.
Vue.js is an open-source progressive JavaScript framework
HTML refers to Hypertext Markup Language. HTML is the gateway ...
Java is an object-oriented, class-based computer-programming language.
PHP is an open-source,interpreted scripting language.
Spring is a lightweight framework.Spring framework makes ...
JavaScript is an scripting language which is lightweight and cross-platform.
CSS refers to Cascading Style Sheets...
jQuery is a small and lightweight JavaScript library. jQuery ...
SQL is used to perform operations on the records stored in the database.
C programming is considered as the base for other programming languages.
JavaScript is an scripting language which is lightweight and cross-platform.
Vue.js is an open-source progressive JavaScript framework
ReactJS is a declarative, efficient, and flexible JavaScript library.
jQuery is a small and lightweight JavaScript library. jQuery ...
Node.js is a cross-platform environment and library for running JavaScript app...
TypeScript is a strongly typed superset of JavaScript which compiles to plain JavaScript.
Angular JS is an open source JavaScript framework by Google to build web app...
JSON is lightweight data-interchange format.
AJAX is an acronym for Asynchronous JavaScript and XML.
ES6 or ECMAScript 6 is a scripting language specification ...
Angular 7 is completely based on components.
jQuery UI is a set of user interface interactions built on jQuery...
Python tutorial provides basic and advanced concepts of Python.
Java is an object-oriented, class-based computer-programming language.
Node.js is a cross-platform environment and library for running JavaScript app...
PHP is an open-source,interpreted scripting language.
Go is a programming language which is developed by Google...
C programming is considered as the base for other programming languages.
C++ is an object-oriented programming language. It is an extension to C programming.
C# is a programming language of .Net Framework.
Ruby is an open-source and fully object-oriented programming language.
JSP technology is used to create web application just like Servlet technology.
The JSTL represents a set of tags to simplify the JSP development.
ASP.NET is a web framework designed and developed by Microsoft.
Perl is a cross-platform environment and library for running JavaScript...
Scala is an object-oriented and functional programming language.
VBA stands for Visual Basic for Applications.
Spring is a lightweight framework.Spring framework makes ...
Spring Boot is a Spring module that provides the RAD feature...
Django is a Web Application Framework which is used to develop web applications.
Servlet technology is robust and scalable because of java language.
The Struts 2 framework is used to develop MVC based web applications.
Hibernate is an open source, lightweight, ORM tool.
Solr is a scalable, ready-to-deploy enterprise search engine.
SQL is used to perform operations on the records stored in the database.
MySQL is a relational database management system based...
Oracle is a relational database management system.
SQL Server is software developed by Microsoft.
PostgreSQL is an ORDBMS.
DB2 is a database server developed by IBM.
Redis is a No SQL database which works on the concept of key-value pair.
SQLite is embedded relational database management system.
MongoDB is a No SQL database. It is an document-oriented database...
Memcached is a free, distributed memory object caching system.
Hibernate is an open source, lightweight, ORM tool.
PL/SQL is a block structured language that can have multiple blocks in it.
DBMS Tutorial is software that is used to manage the database.
Spark is a unified analytics engine for large-scale data processing...
IntelliJ IDEA is an IDE for Java Developers which is developed by...
Git is a modern and widely used distributed version control system in the world.
GitHub is an immense platform for code hosting.
SVN is an open-source centralized version control system.
Maven is a powerful project management tool that is based on POM.
Jsoup is a java html parser.
UML is a general-purpose, graphical modeling language.
RESTful Web Services are REST Architecture based Web Services.
Postman is one testing tools which is used for API testing.
JMeter is to analyze the performance of web application.
Jenkins builds and tests our software projects.
SEO stands for Search Engine Optimization.
MATLAB is a software package for mathematical computation, visualization...
Unity is an engine for creating games on multiple platforms.
Hadoop is an open source framework.
Pig is a high-level data flow platform for executing Map Reduce programs of Hadoop.
Spark is a unified analytics engine for large-scale data processing...
Spring Cloud is a framework for building robust cloud applications.
Spring Boot is a Spring module that provides the RAD feature...
AI is one of the fascinating and universal fields of Computer.
Cloud computing is a virtualization-based technology.
AWS stands for Amazon Web Services which uses distributed IT...
Microsoft Azure is a cloud computing platform...
IoT stands for Internet of Things...
Spring Cloud is a framework for building robust cloud applications.
Email:jjw.quan@gmail.com