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

Save-Branch #4

Open
Jaykul opened this issue Apr 26, 2015 · 5 comments
Open

Save-Branch #4

Jaykul opened this issue Apr 26, 2015 · 5 comments
Milestone

Comments

@Jaykul
Copy link
Member

Jaykul commented Apr 26, 2015

Once you've added some work to the index, you have to commit it.

@Jaykul Jaykul added the v1 label Apr 26, 2015
@Jaykul Jaykul modified the milestone: PSGit v1 Apr 26, 2015
@Jaykul Jaykul added new cmdlet and removed v1 labels Apr 26, 2015
@dahlbyk
Copy link

dahlbyk commented May 16, 2015

Save-GitIndex or Save-GitCommit (since commit is also a noun)?

@Jaykul
Copy link
Member Author

Jaykul commented May 17, 2015

Convince me @dahlbyk ...
Right now I've got a bunch of verbs with the same "Branch" noun:
New-Branch, Remove-Branch, Get-Branch, Set-Branch, Save-Branch, Merge-Branch, etc.

@dahlbyk
Copy link

dahlbyk commented May 17, 2015

Maybe I'm too far in the weeds, but to me there is an important distinction between a Commit (content + parent(s) + metadata) and a Branch (a reference that updates when you commit while it's checked out). Would Save-Branch work if I don't actually have a branch checked out? Can I pipe a branch into Save-Branch? The noun just doesn't make sense to me for actions involving creating commits.

The same would go for Merge-Branch - you merge one or more commits that may or may not be identified by a branch reference.

The others align well for manipulating the branch references themselves, a la git branch.

@Jaykul
Copy link
Member Author

Jaykul commented May 18, 2015

I guess if we make "index" a noun, we could reuse it in a few other places.

And of course, maybe I'm not far enough in the weeds (If so, can you give me a simple script test-case/example?)

  • Is it possible for a working directory to be in a state where no branch is checked out?
  • Is it possible to make a commit that isn't against any branch?

I guess the question is how much are we simplifying this command? I mean, I'm taking it for granted that we're not going to expose most of the built-in parameters. After all, I love a good fixup/squash/reuse with rebase interactive, but:

  • Does anyone actually GPG-sign their commits?
  • Or use named templates for commit messages?
  • Does anyone ever do a dry-run?
  • Or use cleanup on their commit messages?
  • ...

@dahlbyk
Copy link

dahlbyk commented May 18, 2015

I guess if we make "index" a noun, we could reuse it in a few other places.

Reset-GitIndex for the path version of reset sticks out in my mind. Not sure what else?

For the git commit analog, discoverability might drive toward Save-GitCommit or even New-Commit?

Is it possible for a working directory to be in a state where no branch is checked out?

Yep - it's called a "detached HEAD". You might get there if you checkout a tag, for example. You're also technically in that state in the middle of a rebase, though posh-git will show you the branch you're rebasing if possible.

Is it possible to make a commit that isn't against any branch?

Yep. Not super common since creating branches is so cheap, but nothing prevents it and I do so every once in a while. Simple example:

cat .git/HEAD                  # likely ref: refs/heads/some-branch
git checkout HEAD~0            # detach at current HEAD
cat .git/HEAD                  # now a 40-digit SHA
git commit --allow-empty -m 'Headless!'
git log --oneline --decorate   # should see previous branch as parent
git checkout -b new-branch     # create new-branch at new commit

I guess the question is how much are we simplifying this command? I mean, I'm taking it for granted that we're not going to expose most of the built-in parameters.

Agree 100% that many parameters won't have any use. Like --porcelain or -z for machine-readable output...because PowerShell. 😀 The "ROI" for most parameters just won't be there unless you find a motivated contributor that really cares about GPG signing.

That said, I expect (hope?) you'll find enough more advanced

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

No branches or pull requests

2 participants