Quick Git Setup - vanaware/openwrt GitHub Wiki
Fork lede or openwrt source into local and back to github
git clone https://github.com/openwrt/openwrt.git openwrt
cd openwrt
git remote -v
origin https://github.com/lede-project/source.git (fetch)
origin https://github.com/lede-project/source.git (push)
git remote rename origin upstream
git remote add origin https://github.com/vanaware/openwrt.git
git remote -v
origin https://github.com/vanaware/openwrt.git (fetch)
origin https://github.com/vanaware/openwrt.git (push)
upstream https://github.com/lede-project/source.git (fetch)
upstream https://github.com/lede-project/source.git (push)
git push -u origin master
Get changes from upstream
git fetch upstream
git checkout master
git merge upstream/master
git push -u origin master
git checkout lede-17.01
git merge upstream/lede-17.01
git push -u origin lede-17.01
git checkout openwrt-18.06
git merge upstream/openwrt-18.06
git push -u origin openwrt-18.06
Create new branch
copy from latest version of a branch
git checkout lede-17.01
git checkout -b lede-17.01-tl-mr3420-v1-usbmount lede-17.01
git push -u origin lede-17.01-tl-mr3420-v1-usbmount
Copy specific openwrt version
Version | Commit hash |
---|---|
17.01.4 | 444add156f2a6d92fc15005c5ade2208a978966c |
17.01.5 | 248b35890339d70d7b43e3b40fba0281f854ed9a |
17.01.6 | 9a96ec08a953a409b76b1d5f90de183c51937547 |
17.01.7 | 14fb5b4f15c2ea1d3e3912add38a4036088b93fa |
18.06.0 | 03b693064b6ad85ce9c57ab0226b986b09c8eb05 |
18.06.1 | 70255e3d624cd393612069aae0a859d1acbbeeae |
18.06.2 | a02809f61bf9fda0387d37bd05d0bcfe8397e25d |
18.06.3 | 4382d4ce19a95aa0d2ebd098c6b54feced21e7f9 |
18.06.4 | f6429577c5110fe3ad5575c797e884e87027726c |
18.06.5 | 5e4533cdd4b132959bf24dbfd546466a1fabb232 |
18.06.6 | 8004e3f2c6c27e3ce0ae440198a3f2c3735da492 |
18.06.7 | 1b5c116233a8c9421e97a1336bcf7cb3d42eca7d |
19.07.0 | aca39acedf98aa7e40119692f6b94681096becd2 |
19.07.1 | 901bbe2ab97efd3af0eb00efc3b413617145d654 |
19.07.2 | 33732f4a9c17921b782167a0dcaba9703d4e6753 |
copy from specific version of a branch = version 17.01.4
git checkout -b lede-17.01.04-tl-mr3420-v1-usbmount 444add156f2a6d92fc15005c5ade2208a978966c
git push -u origin lede-17.01.04-tl-mr3420-v1-usbmount
copy from specific version of a branch = version 18.06.0
git checkout -b openwrt-18.06.0-iomega_ix2_200 03b693064b6ad85ce9c57ab0226b986b09c8eb05
git push -u origin openwrt-18.06.0-iomega_ix2_200
copy from specific version of a branch = version 18.06.1
git checkout -b openwrt-18.06.1-px4-300d 70255e3d624cd393612069aae0a859d1acbbeeae
git push -u origin openwrt-18.06.1-px4-300d
Set global user
git config --global user.name "my name"
git config --global user.email "[email protected]"
##Add modifications and push changes
git add -i
git commit --signoff
git push --all
###Add modifications to the same commit
git add -i
git commit --amend
git push --force
##List all branches
git branch
lede-17.01
- lede-17.01.04-tl-mr3420-v1-uboot
lede-17.01.04-tl-mr3420-v1-usbmount
master
##Renomear Branch
git branch -m lede-17.01.04-tl-mr3420-v1-rootfs lede-17.01.04-u35wf
##Update Files from upstream on a forked repository
###Existing branches
git fetch upstream
git checkout master
git merge upstream/master
git push --all
git checkout lede-17.01
git merge upstream/lede-17.01
git push --all
git checkout openwrt-18.06
git merge upstream/openwrt-18.06
git push --all
git checkout openwrt-19.07
git merge upstream/openwrt-19.07
git push --all
###New Branches
git checkout openwrt-18.06
git merge upstream/openwrt-18.06
git push -u origin openwrt-18.06
###Git workTree
https://git-scm.com/docs/git-worktree
https://www.saltycrane.com/blog/2017/05/git-worktree-notes/
cd /srv/openwrt/master/
git worktree add ../openwrt-18.06.1-px4-300d openwrt-18.06.1-px4-300d
Or, if that branch isn't created yet and you want to branch off 18.06.4 commit :
git worktree add -b openwrt-18.06.4-px4-300d ../openwrt-18.06.4-px4-300d f6429577c5110fe3ad5575c797e884e87027726c
###Git from Http to SSH
git remote -v
origin https://github.com/vanaware/openwrt.wiki.git (fetch)
origin https://github.com/vanaware/openwrt.wiki.git (push)
git remote set-url origin [email protected]:vanaware/openwrt.wiki.git
git remote -v
origin [email protected]:vanaware/openwrt.wiki.git (fetch)
origin [email protected]:vanaware/openwrt.wiki.git (push)
git remote -v
origin [email protected]:vanaware/openwrt.git (fetch)
origin [email protected]:vanaware/openwrt.git (push)
upstream https://github.com/openwrt/openwrt.git (fetch)
upstream https://github.com/openwrt/openwrt.git (push)