You are not logged in.

#1 2026-07-11 16:43:26

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,228

[Workaround] git backport changes in master to stable except 1 file ?

master branch
stable 0.1 branch

I made some changes in master that I now want to backport to the stable stree.

When trying git rebase master from the 0.1 branch I get this :

$ git rebase master
warning: skipped previously applied commit eba3ad9
hint: use --reapply-cherry-picks to include skipped commits
hint: Disable this message with "git config set advice.skippedCherryPicks false"
Auto-merging VERSION
CONFLICT (content): Merge conflict in VERSION
error: could not apply 3afa26e... bump version to 0.1.0
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Could not apply 3afa26e... # bump version to 0.1.0
$ 

The VERSION file does exist in both branches but is intended to be maintained separately and commits changing it should have no effect on other branches .

One way might be to skip commits that change VERSION but I'm not sure if that commit will then still be present in the 0.1 branch .
How to backport the changes to master except the one in VERSION ?

Last edited by Lone_Wolf (Yesterday 12:12:28)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#2 2026-07-11 19:07:27

loqs
Member
Registered: 2014-03-06
Posts: 18,973

Re: [Workaround] git backport changes in master to stable except 1 file ?

Do you have a feature branch that just contains the feature you merged into master that you now want in stable 0.1? If not do you want every commit from master apart from those touching  VERSION?

Offline

#3 2026-07-11 19:11:53

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,896

Re: [Workaround] git backport changes in master to stable except 1 file ?

Problem is gonna be if a commit touches multiple files and *also* VERSION

You'll have to resolve the conflict, see https://stackoverflow.com/questions/578 … s-or-files
But idk whether you can implant --theirs/--ours <file> as specific partial --strategy to automate that (partially subscribing in case somebody knows wink)

Offline

#4 2026-07-11 21:56:27

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,228

Re: [Workaround] git backport changes in master to stable except 1 file ?

No feature branch, just master and one stable branch for now .
I test the code changes outside of git and frequently update master locally then push it to upstream origin .

I looked at the recent commits for master and realised there is one that changes VERSION and one other file.
The VERSION file was added to have a simple way to distinguish between branches/versions but it seems things have gotten more complex instead of simpler .

I can workaround the conflict by applying the changes manually. Problem with that is it won't work for complex changes.

Maybe developing in separate branches and not in master is the best option even for a simple small one-man repo ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#5 2026-07-11 22:47:04

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,896

Re: [Workaround] git backport changes in master to stable except 1 file ?

The VERSION file was added to have a simple way to distinguish between branches/versions

git branch --show-current

?
I have that in my $RPS1 (right aligned prompt, zsh)

Offline

#6 2026-07-11 23:14:55

killertofus
Member
Registered: 2025-02-10
Posts: 207

Re: [Workaround] git backport changes in master to stable except 1 file ?

this is in mine

parse_git_branch() {
  local branch=""
  branch=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
  local git_status=$(git status --porcelain 2>/dev/null)
  local color=green
  if echo "$git_status" | grep -q "^ M"; then
    color=#DA70D6
    branch="${branch}*"
  fi
  if echo "$git_status" | grep -qE "^ A|^\?\?"; then
    color=cyan
    branch="${branch}+"
  fi
  if echo "$git_status" | grep -q "^ D"; then
    color=red
    branch="${branch}-"
  fi

  if [[ -n "$branch" ]]; then
    branch=[%F{${color}}${branch}%F{reset}]
  fi
  echo "$branch"
}
update_prompt() {
PS1="%F{cyan}%~
%F{green}%1~ %F{magenta}❯%{$reset_color%}$(parse_git_branch) "

}
precmd_functions+=(update_prompt)
update_prompt

I Have Linux Perl Can i Download Gnome???

Offline

#7 2026-07-12 21:53:42

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,228

Re: [Workaround] git backport changes in master to stable except 1 file ?

I use bash, no idea if that's possible with a bash prompt. It does appear to be limited to cli and won't help in a gui filemanager .

The simplest solution appears to remove the VERSION file and instead add 1 file called <name-of-branch>.branch to each branch.
Adding *.branch to .gitignore should prevent merge conflicts and ensure only manually created .branch files exist.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#8 2026-07-12 22:39:02

killertofus
Member
Registered: 2025-02-10
Posts: 207

Re: [Workaround] git backport changes in master to stable except 1 file ?

it can be done in your bash prompt https://web.archive.org/web/20160704140 … rompt.html


I Have Linux Perl Can i Download Gnome???

Offline

#9 2026-07-13 12:09:11

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,228

Re: [Workaround] git backport changes in master to stable except 1 file ?

Interesting and the script they mention is present in /usr/share/git .

Looks like I'll be using prompt for cli as well as an untracked file for gui .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#10 2026-07-18 10:48:10

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,228

Re: [Workaround] git backport changes in master to stable except 1 file ?

I've changed my bash prompt and now my ~/.bashrc has

source /usr/share/git/git-prompt.sh
PS1='[\u@\h \W]$(__git_ps1 " (%s)")\$ '

Works fine and helps a lot with keeping track of the branch i'm working on.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#11 Yesterday 12:12:02

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,228

Re: [Workaround] git backport changes in master to stable except 1 file ?

The question I asked in the opening post hasn't been answered, but atleast there's a usable workaround.

Maybe what I wanted is impossible with git but it's still unclear.
Marking as workaround.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

Board footer

Powered by FluxBB