Skip to content

Save-Branch #4

Open
Open

Description

@Jaykul

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

Activity

  1. modified the milestone: PSGit v1 on Apr 26, 2015
  2. dahlbyk commented on May 16, 2015

    @dahlbyk

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

  3. Jaykul commented on May 17, 2015

    @Jaykul
    MemberAuthor

    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.

  4. dahlbyk commented on May 17, 2015

    @dahlbyk

    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.

  5. Jaykul commented on May 18, 2015

    @Jaykul
    MemberAuthor

    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?
    • ...
  6. dahlbyk commented on May 18, 2015

    @dahlbyk

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions