How to rebase w/o loosing some changing

Hi,

question, when I build my firmware, I add 2 new feeds in feeds.conf.default and a new folder in buildroot but everytime I do git pull rebase those files/folders are deleted....

Do you know what to do about that?

thanks

Assuming your remote is named origin:

git fetch origin
git switch master
git rebase origin/master

You can then switch to a working branch (if any) and rebase THAT branch

git switch working
git rebase master

Edit: I keep my local master branch at the same HEAD as the repo, this way I can always easily start a fresh branch.

1 Like

I use only master branch usually

1 Like

Then the first block is all you'll need.

1 Like

so don't need to use git stash, or somethiing like git pull --rebase --autostash ?

If you have UNCOMMITTED changes, then you should git add and then git commit them, then rebase.. You can remove it later via git reset if you need to.

You shouldn't use git pull at all

Rebasing will put your local commits at the HEAD of the repo.. On top of everything upstream.

Pulling will MERGE the upstream with your local.. I find I don't want a roll-up of the commits, I want to see what they are, so I use git rebase over git pull every time

Even if I'm always in master, I need to git switch master?

And what about your print screen, what is command to see that?
thanks btw

If you're always on master, than no, it'll just tell you that you're already on `master'.

That is the git lg alias I use (git log alternative)..

From http://garmoncheg.blogspot.com/2012/06/pretty-git-log.html

git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"

1 Like

ok great, it is the same as https://git.openwrt.org/.

1 Like

Finally, I tried it. My stuffs have been deleted.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   include/kernel-5.10
	modified:   target/linux/ath79/patches-5.10/910-unaligned_access_hacks.patch
	modified:   target/linux/bcm27xx/patches-5.10/950-0310-vc4_hdmi-Remove-cec_available-flag-as-always-support.patch
	modified:   target/linux/bcm27xx/patches-5.10/950-0349-drm-vc4-Add-all-the-HDMI-registers-into-the-debugfs-.patch
	modified:   target/linux/bcm27xx/patches-5.10/950-0457-drm-vc4-hdmi-Introduce-a-CEC-clock.patch
	modified:   target/linux/bcm27xx/patches-5.10/950-0459-drm-vc4-hdmi-Support-BCM2711-CEC-interrupt-setup.patch
	modified:   target/linux/bcm27xx/patches-5.10/950-0460-drm-vc4-hdmi-Don-t-register-the-CEC-adapter-if-there.patch
	modified:   target/linux/bcm27xx/patches-5.10/950-0475-drm-vc4-Add-HDR-metadata-property-to-the-VC5-HDMI-co.patch
	modified:   target/linux/bcm27xx/patches-5.10/950-0576-drm-vc4-hdmi-Raise-the-maximum-clock-rate.patch
	modified:   target/linux/bcm27xx/patches-5.10/950-0601-drm-vc4-hdmi-Rely-on-interrupts-to-handle-hotplug.patch
	modified:   target/linux/bcm27xx/patches-5.10/950-0602-drm-vc4-hdmi-Add-a-workqueue-to-set-scrambling.patch
	modified:   target/linux/bcm27xx/patches-5.10/950-0639-cgroup-Disable-cgroup-memory-by-default.patch
	modified:   target/linux/bcm27xx/patches-5.10/950-0654-drm-vc4-hdmi-Use-a-fixed-rate-for-the-HSM-clock-on-B.patch
	modified:   target/linux/bcm27xx/patches-5.10/950-0668-drm-vc4-hdmi-Split-the-CEC-disable-enable-functions-.patch
	modified:   target/linux/mediatek/patches-5.10/703-v5.17-net-ethernet-mtk_eth_soc-implement-Clause-45-MDIO-ac.patch
	modified:   target/linux/ramips/patches-5.10/700-net-ethernet-mediatek-support-net-labels.patch

s@msi:/media//master$ git rebase origin/master
error: cannot rebase: You have unstaged changes.
error: additionally, your index contains uncommitted changes.
error: Please commit or stash them.
s@msi:/media/master$ git stash
Saved working directory and index state WIP on master: 04ed224543 hostapd: refresh patches
s@msi:/media/master$ git status
On branch master
Your branch is behind 'origin/master' by 12 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	package/luci-app-argon-config/
	package/luci-theme-argon/

nothing added to commit but untracked files present (use "git add" to track)
s@msi:/media/master$ git rebase origin/master
First, rewinding head to replay your work on top of it...
Fast-forwarded master to origin/master.

When I did git stash as git asked me to be able to do git rebase master, some of my files hav been deleted

When you did the git stash, it stashed them.. type git help stash because you can reload the stash

2 Likes

This was the commit it stashed it as, so you can find it easier.

A simpler solution may be copying feeds.conf.defaults to feeds.conf and modifying the copy, it will take precedence over the .default file.

1 Like

if I'm remember, feeds.confdoes not exist in the buildroot directory,right? I need to create it in my openwrt folder?