Skip to content

SmallSharpToolsOpenSource/MessingWithGit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Messing with Git

Typically with a git repository has a master branch and a single remote called origin for master. It is possible to add more than one remote in the same repository. The benefit is that local branches can be pushed to the alternate remote to create a remote copy of the local changes without pushing to the origin remote. And once work is ready to be merged to the master branch on the origin remote a rebase can be done with the local branch to master and then pushed to the origin remote.

Below shows the default git configuration before and after adding another remote called dev.

Adding Alternate Remote

 > more .git/config 
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = true
[remote "origin"]
        url = git@github.com:brennanMKE/MessingWithGit.git
        fetch = +refs/heads/*:refs/remotes/origin/*


 > git remote add dev git@github.com:brennanMKE/MessingWithGit.git
 > more .git/config 
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = true
[remote "origin"]
        url = git@github.com:brennanMKE/MessingWithGit.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[remote "dev"]
        url = git@github.com:brennanMKE/MessingWithGit.git
        fetch = +refs/heads/*:refs/remotes/dev/*

Specifically the following command adds the alternate remote.

git remote add dev git@github.com:brennanMKE/MessingWithGit.git

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published