eli-schwartz / aurpublish

PKGBUILD management framework for the Arch User Repository
GNU General Public License v2.0
246 stars 18 forks source link

[Enhancement] reset package to upstream state #10

Open LW-archlinux opened 4 years ago

LW-archlinux commented 4 years ago

Sometimes adding changes goes wrong and people have trouble reverting to a known good state. A simple way to solve this with a single git repo is to remove the local git repo and re-clone the upstream repo .

having a command to do this in the aurpublish combined repo would be a good thing. possible invocation aurpublish -reset PACKAGE

eli-schwartz commented 4 years ago

remove the local git repo and re-clone the upstream repo

That sounds kind of awkward if you ask me.

...

What kind trouble are we talking about here? If there are AUR commits which are not locally present and local commits which are not remotely present, -p PACKAGE should pull those changes and activate the git merge machinery if needed. Otherwise, shouldn't git checkout HEAD PACKAGE/ be sufficient?

LW-archlinux commented 4 years ago

example : add files for one package to the folder for another package add a commit message, push . push is rejected because of missing files or other imcompatibilities , realise the mistake and try to correct it.

Does git checkout HEAD remove the incorrect commit(s) ?

eli-schwartz commented 4 years ago

If the conflicting commit is the most recent one, you could use git commit --amend.

You can also use git rebase and choose one or more commits to checkout, edit for correctness, and turn into a series of commits which the AUR will accept. Note that you cannot rebase commits which you have already published with aurpublish, since the AUR does not permit force pushes.

alerque commented 4 years ago

What if I accidentally rebased local commits after pushing to AUR? How do I get back to a workable situation where my local work is on top of what the AUR already knows about? I.e. rebase anything I have that touches that subtree onto the remote commits.

eli-schwartz commented 4 years ago

You could use the reflog to find the last good commit. In general, rebase is a powerful tool which you should treat with care; standard advice for git is to not force push public history, subtrees just make that cause conflicts visible to the repository owner instead of only to downstream people who have cloned it.

If you really just want to delete it from git, then re-add the package from scratch, it's probably as simple as 'git rm -r pkg/; git commit; aurpublish -p pkg'. But I haven't experimented.