Git pull behaviour

hi,

just to be sure I did not make any error, here what I have after git pull in my /openwrt folder before to compile my new build. So, git pull gave me ;

james@e6530:~/openwrt$ git pull
Merge made by the 'recursive' strategy.
 package/network/services/odhcpd/Makefile | 6 +++---
 rules.mk                                 | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

and just before that, nano has been opened with '' explain why you want to merge 2 branch etc..

seems ok? :wink:

ames @ e6530: ~ / openwrt $ git checkout master
Already on 'master'
Your branch is ahead of 'origin / master' by 2 commits.
  (use "git push" to publish your local commits)


maybe I did something, I tried today to upload my openwrt folder to github rep

Maybe / not, you appear to have modified things and it is attempting to merge, depends on what you want.

git status
2 Likes
james @ e6530: ~ / openwrt $ git status
On the master branch
Your branch is ahead of 'origin / master' by 2 commits.
  (use "git push" to publish your local commits)

Untracked files:
  (use "git add <file> ..." to include in what will be committed)

package / luci-theme-argon /
package / qBittorrent-openwrt-package /

no changes added to commit but untracked files are present (use "git add" to track them)


I dont really want to do soimething, but I added qbittorrent and argon theme yesteday but it is already compiled on my build, but when I added my folder to git hub via github desktop, those 2 things were appeared

If you check git log, both of those received a push today, so that would appear to be related to whatever you had done in your own tree.

2 Likes

Yes, you did:

You have added local commits. So, when you now try to update official sources, the system says that you need to "merge" things, as you can't just fast-forward to the global HEAD. You have a different claim to the git history and the official upstream.

You could do "git pull --rebase", which would try to fast-forward to the HEAD while rebasing (actually moving) local local commits to be based on top of the new upstream commits. If there are no conflicts, that should succeed.
Or if you already have a merge, you could do "git rebase origin/master"

You might also try "git log --oneline --graph" first, so that you see your own deviation from the origin/master

Normal git stuff, again. You might start by reading suitable material from the first few hits in
https://www.google.com/search?q=git+pull+with+local+commits

Other approach might be to "not commit" the local changes, but just keep them on the directories as non-committed files. I use that approach. Both approaches work, but require different

Ps.
And naturally you have no push rights to the global Openwrt main code or feed repositories, so you can only change files in

  • your local directories (and local git repo), and
  • your own github fork if you have created that (which I assume you have not yet done, and would actually only need if you want to issue Pull Requests to upstream).
1 Like

One example

for main Openwrt, the git log upstream is straight, as no merges are allowed. Developers directly push the new commits to make a straight history:

perus@ub2010:/Openwrt/r7800$ git log --oneline --graph
* ec0c6c1143 (HEAD -> master, origin/master, origin/HEAD) tools/zstd: compile with cmake
* 7534c8a2e1 tools/zstd: update to 1.4.8
* ddab795b37 rules: fix empty COMMITCOUNT/AUTORELEASE
* 1b484f1a12 odhcpd: update to latest git HEAD
* 4c6c1c6dd0 trusted-firmware-a.mk: pass package version as version identifier
* a04bffebba arm-trusted-firmware-mvebu: pass commit ids to a3700-utils/mv-ddr-marvell
* 5fae94d987 arm-trusted-firmware-mvebu: bump espressobin boards to CPU_1000_DDR_800
* 8f3bd881c9 arm-trusted-firmware-mvebu: update to v2.4

But for the packages and LuCI feeds, where there are PRs and their merges, you can see similar that has now accidentally happened locally for you. There are simultaneously authored different commits side by side, and the the PR is accepted, the side commits get "merged" to the main code.

perus@ub2010:/Openwrt/r7800/feeds/luci$ git log --oneline --graph
* af1f96158 (HEAD -> master, origin/master, origin/HEAD) timezone data: update to 2021a
* 1cbf7db6c Translated using Weblate (Hungarian)
* 28496a170 Translated using Weblate (Chinese (Traditional))
* 7e0705237 Translated using Weblate (Chinese (Traditional))
* fb6e62eca Translated using Weblate (Welsh)
*   bda65a269 Merge pull request #4740 from zhanhb/luci-app-ddns
|\  
| * 4d5facb31 luci-app-ddns: fix wget-ssl path
* | c434b50c7 Translated using Weblate (Finnish)
* | af422b192 treewide: removed trailing whitespaces and extra newlines in 'modules'
* | d3280e6f5 treewide: minor fixes to typos, whitespace, and indentation
* |   03d11de79 Merge pull request #4742 from cartender/pr/fix_try_catch_poll__master
|\ \  
| * | 763158600 luci-base: luci.js: fix `LuCI.request.poll.add()` exception handling
* | | e7531176a treewide: sync translations
* | | dfa82b449 luci-mod-status,luci-app-statistics: Fix case for 'Bit/s' to 'bit/s'
* | | cc7f420c5 Translated using Weblate (Chinese (Traditional))
|/ /  
* / bce961729 Translated using Weblate (Korean)
|/  
* 34e2d6e19 Translated using Weblate (Chinese (Traditional))
*   4f3934172 Merge pull request #4667 from TDT-AG/pr/20201218-luci-base-tooltip
|\  
| * ab390cf94 luci-app-firewall: add tooltip on rules that have time restrictions enabled
| * 4bbf6db9d luci-app-firewall: add limited masquerading tooltip
| * df2a135a0 luci-base: make tooltip icon string configurable
| * e951236e3 luci-base: add tooltip handling
* | ab9de0784 Translated using Weblate (Chinese (Traditional))
* |   4a9241fed Merge pull request #4729 from stangri/master-luci-app-https-dns-proxy
|\ \  
| * | c0b1e5132 luci-app-https-dns-proxy: DSCP tagging support
|/ /  
* |   60c27aa0f Merge pull request #4665 from berenyibalazs/softether


here log and before I do my new image some hours ago, after I saw those infos after ''git pull'', I did make dirclean.....

~/openwrt$ git log --oneline --graph
*   00227b603e (HEAD -> master) Merge branch 'master' of https://git.openwrt.org/openwrt/openwrt
|\  
| * ddab795b37 (origin/master, origin/HEAD) rules: fix empty COMMITCOUNT/AUTORELEASE
| * 1b484f1a12 odhcpd: update to latest git HEAD
* | 47734d9398 openwrt
|/  
* 4c6c1c6dd0 trusted-firmware-a.mk: pass package version as version identifier
* a04bffebba arm-trusted-firmware-mvebu: pass commit ids to a3700-utils/mv-ddr-marvell
* 5fae94d987 arm-trusted-firmware-mvebu: bump espressobin boards to CPU_1000_DDR_800
* 8f3bd881c9 arm-trusted-firmware-mvebu: update to v2.4
* a9c20d56f1 uboot-mvebu: update to v2021.01
* 00bf2c0cbe arm-trusted-firmware-mvebu: don't build emmc variants
* 24b910dca2 mvebu: LS421DE: fix the thermal zones
* e9d551fac1 strace: update package to v5.10
* 95b30f84d2 base-files: mount pstore if present
* 5b66c447f3 ath10k-ct: update to latest version
* ea1cdd1901 ca-certicficates: Update to version 20210119
* eb11cd9ea3 ramips: add support for ELECOM WRC-2533GHBK-I


also, here what I have as version info after my new buid, first time I see the ''+2''

r15655+2-ddab795b37

Yes, there are now 2 "your commits" that the official OpenWrt knows nothing about. So, you are no anymore fully on the official sources. Last know official commit is ddab795b37 but in addition there are +2 extra commits...

There is your private commit and your merge commit.

*   00227b603e (HEAD -> master) Merge branch 'master' of https://git.openwrt.org/openwrt/openwrt
...
* | 47734d9398 openwrt
|/  

You might try that "git rebase origin/master"

Welcome to the nice world of git, which is really versatile, but there is a learning curve. Having your own modifications on top of the official code required some careful working every time when you update sources. You better start reading about git. There is lots of good stuff available from github, Atlassian, whatever

make dirclean does not touch the source code (the git repo). It only removes the compiled build artefacts and the compiled toolchain.

2 Likes

ok thanks, I didn't want to change anything, but I made a mistake, with the wrong command :wink:

ok, yesterday it was 2 commits, now 1 remaining

james @ e6530: ~ $ cd openwrt
james @ e6530: ~ / openwrt $ git rebase origin / master
The current master branch is up to date.
james @ e6530: ~ / openwrt $ git rebase
Head rewind beforehand to be able to replay your work on top ...
Application of openwrt
james @ e6530: ~ / openwrt $ git checkout master
Already on 'master'
Your branch is ahead of 'origin / master' by 1 commit.
   (use "git push" to publish your local commits) 

in same times, I still see that : I wonder if I can remove that kind of status?

0: ~ / openwrt $ git status
On the master branch
Your branch is ahead of 'origin / master' by 1 commit.
   (use "git push" to publish your local commits)

Untracked files:
   (use "git add <file> ..." to include in what will be committed) just ''git add'' and I will be ok, but those ipk are already in my build

package / luci-theme-argon /
package / qBittorrent-openwrt-package /

no changes added to commit but untracked files are present (use "git add" to track them) 

maybe that ; 

git reset --hard origin/master or git branch -D master
git checkout origin/master -b master