Git
Posted on February 25, 2022 • 2 minutes • 242 words • Other languages: Deutsch
I like to use open source projects for my smart home projects. Since these projects may occasionally be deleted depending on their size and popularity, further development, updating, or reconfiguration would be impossible without access to the original repository. That’s why I copy the corresponding repositories into my own local Git. I keep my personal configurations and adjustments, such as default values, certificates and access data, in a separate branch. I build all projects exclusively on this (my) branch in my repository. To ensure that my cloned repository stays current, I regularly sync it with the original repository without accidentally pushing back my changes. Below I will explain how I do this using Tasmota as an example.
- Clone repository
> git clone https://github.com/arendst/Tasmota.git
- List existing remotes
> git remote -v
origin https://github.com/arendst/Tasmota.git (fetch)
origin https://github.com/arendst/Tasmota.git (push)
- Add a new ‘origin’ remote’s URL
> git remote set-url origin http://git.lokal/Tasmota.git
- Add a new remote repository
> git remote add upstream https://github.com/arendst/Tasmota.git
- Disable pushing to that repository
> git config remote.upstream.pushurl "not this direction"
- List existing remotes
> git remote -v
origin http://git.lokal/Tasmota.git (fetch)
origin http://git.lokal/Tasmota.git (push)
upstream https://github.com/arendst/Tasmota.git (fetch)
upstream not this direction (push)
- Pull updates from upstream’s master into my master
> git pull upstream master:master --allow-unrelated-histories
- … and push
> git push origin master
Nw I am able merge the master into my branch, configure, … and atleast I need to push my branch
> git push origin bc6
