Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command to backup the stack to the remote in case machine failure #66

Open
drewdeponte opened this issue Apr 30, 2022 · 9 comments
Open

Comments

@drewdeponte
Copy link
Owner

@chillbrodev mentioned in chat

had a random idea of a backup feature where you could use gps backup and it creates remote branches of all your patches even if there are patch dependencies. I do this when Im about to travel and have a few loose patches for those “just in case fears”.

Maybe this just becomes in option on sync -all for sync all or something.

I am not sure how valuable I really feel this command is.

@chillbrodev
Copy link

The value is quite small and niche. Its more of a feature that is rarely used though I see how it could be abused to create patch PRs with dependencies. CI would fail the PR since it couldn't build it and maybe it makes sense to inject the word "BACKUP" or something into the commit. Thinking out loud here.

@drewdeponte
Copy link
Owner Author

drewdeponte commented May 2, 2022

Well if there are conflicts in the cherry-picking it wouldn't be possible to sync the patch. Syncing only works for patches that are independent enough that they can be cherry-picked.

@drewdeponte
Copy link
Owner Author

If you want to back your stack up, it might make more sense to create a stack specific branch and force pushes the stack up to it

@drewdeponte drewdeponte changed the title Add command to sync all patches Add command to backup the stack to the remote in case machine failure May 2, 2022
@chillbrodev
Copy link

Ah this might be more what I am looking for. The Backup Branch would work. We can close this then.

@drewdeponte
Copy link
Owner Author

It still might be nice to have this to help hold the Patch Stack abstraction and make it so you don't have to think about the fact that it is a branch. Also I don't think it is totally straight forward how you would do it.

If we take the example of main as your local branch and it is a tracking branch of the upstream origin/main.

You wouldn't want to push main up to origin/main because that would effectively integrate all of the patches in your stack. Instead we would probably want to do the following.

  • create a new branch ps/stack-backups/main (or something similar) that points to the head commit of the local main branch
  • push the ps/stack-backups/main branch up to the remote associated with the stack, in this case origin so it would then have origin/ps/stack-backups/main

At this point the entire stack would be backed up.

Now we probably also need to think about uniqueness across users because once we push remote if two users do this they would overwrite each others branches. So the branches somehow need to have something user unique in the branch naming.

But I think in theory that would work and I think it is enough of a pain to have to do this manually with git that it would be nice to implement it.

@drewdeponte
Copy link
Owner Author

I think the biggest question in terms of implementation is figuring out where we get user unique identifier. I guess we could pull the user email out of the .gitconfig and hash it to get a unique identifier we can use in the branch name.

@drewdeponte
Copy link
Owner Author

so the branch naming would be something maybe like ps/stack-backups/<user-unique-hash>/main.

drewdeponte added a commit that referenced this issue Jul 8, 2022
Add backup-stack command so that users can easily backup their current
patch stack.

This relates to issue #66.

ps-id: 8dba630d-6f5d-4ea9-80cb-45d597f4bcb0
drewdeponte added a commit that referenced this issue Jul 11, 2022
Add backup-stack command so that users can easily backup their current
patch stack.

This relates to issue #66.

ps-id: 8dba630d-6f5d-4ea9-80cb-45d597f4bcb0
drewdeponte added a commit that referenced this issue Jul 21, 2022
Add backup-stack command so that users can easily backup their current
patch stack.

This relates to issue #66.

ps-id: 8dba630d-6f5d-4ea9-80cb-45d597f4bcb0
drewdeponte added a commit that referenced this issue Jul 21, 2022
Add backup-stack command so that users can easily backup their current
patch stack.

This relates to issue #66.

ps-id: 8dba630d-6f5d-4ea9-80cb-45d597f4bcb0
@Alizter Alizter moved this to Triage in git-ps-rs Oct 13, 2023
@drewdeponte
Copy link
Owner Author

Now that gps no longer has state tracking and it does pure state computation from the Git tree. This likely needs to be rethought.

@drewdeponte drewdeponte moved this from Triage to Discussion in git-ps-rs Oct 13, 2023
@Alizter
Copy link
Contributor

Alizter commented Oct 13, 2023

The goto solution for me is to branch and push to a remote. Especially if I need some patches on another matchine. gps could do this with say gpp bu which would create a patch series for the entire stack and push it to a special branch, say with time and date in the name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants