cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Cloud



Etc


Reference














.

middleware:version-control:git:use-remote-repo-in-local



How to use a remote repository in local

How to bring from remote repositories

Method1 : git clone[Recommend]

$ git clone https://example.com/user/project.git
$ ls
project

Method2 : git init + git remote add + git pull

$ git init
$ git remote add origin https://example.com/user/project.git
$ ls
project
$ cd project
$ git pull origin master




Reacquire information from remote repositories

Method1 : git pull [Recommend]

#Pull the contents of the master branch in the remote repository (origin) to the current branch in the local repository
$ git pull origin master
$ git pull  #origin and master can be omitted.

Method2 : git fetch

$ git fetch origin master     #Obtain information only on the master branch of the remote repository (origin)
Ref:$ git fetch origin   #Get information about all branches in the remote repository (origin)

$ git log  #Confirm changes
$ git checkout origin/master    #Switching work trees
                                #Check the contents of local information for tracking
                                #Information on the master branch of the remote repository (origin)
$ git checkout -a       #List all branches
$ git checkout master   #Switch work tree to master branch; master can be omitted


$ git merge origin/master    # Merge current branch with origin/master








Git - How to use Git.




middleware/version-control/git/use-remote-repo-in-local.txt · Last modified: 2022/03/18 by admin

Page Tools