Ideally, we want to force to rebase our local tree when updating against the
remote. For example, before pushing a change, I want to ensure my remote is in
sync before using git push.
Details
$ make -C /usr/ports update -------------------------------------------------------------- >>> Updating /usr/ports from git repository -------------------------------------------------------------- cd /usr/ports; git pull --rebase origin main remote: Enumerating objects: 26, done. remote: Counting objects: 100% (26/26), done. remote: Compressing objects: 100% (25/25), done. remote: Total 30 (delta 5), reused 1 (delta 1), pack-reused 4 Unpacking objects: 100% (30/30), 268.98 KiB | 5.38 MiB/s, done. From https://git.freebsd.org/ports * branch main -> FETCH_HEAD 7e9a1a19e813..84150d84aa58 main -> origin/main Successfully rebased and updated refs/heads/main.
Diff Detail
- Repository
- rP FreeBSD ports repository
- Lint
No Lint Coverage - Unit
No Test Coverage - Build Status
Buildable 39434 Build 36323: arc lint + arc unit
Event Timeline
Makefile | ||
---|---|---|
192 | origin main is a bit too much, what if I checkout stable/13 ? |
I think adding --rebase is good. We may need to check the remote and branch name because in the document we recommend set remote name as freebsd. Maybe we can use variable with default value here. (${GIT} pull --rebase ${GIT_REMOTE} ${GIT_BRANCH}).
Maybe we can get the current remote and branch using the something like, I'll test that:
GIT_REMOTE=$(git remote)
GIT_BRANCH=$(git rev-parse --symbolic-full-name @|sed 's,refs/heads/,,')
Makefile | ||
---|---|---|
192 | Yeah, just git pull --rebase is fine. This will pull and rebase from the tracked upstream and if people set up their ports repo in strange ways, that's up to them then. |
Makefile | ||
---|---|---|
179 | this should error out and tell people that svn is no longer updated and they need to save their local patches and clone a new tree ... looking for svn a few lines above then might also be fully obsolete (I haven't checked the rest of the file) | |
185 | ditto. This should tell them to use a plain git clone |
We do not need to specify the current branch and remote, as pointed by @uqs by default it uses the tracked upstream
Also confirmed in the git-pull(1) man page
-r, --rebase[=false|true|merges|preserve|interactive] When true, rebase the current branch on top of the upstream branch after fetching.