Giter Club home page Giter Club logo

Comments (6)

siedentop avatar siedentop commented on August 29, 2024 1

Thanks for reporting this! I'm taking a look.

from git-quickfix.

siedentop avatar siedentop commented on August 29, 2024 1

It works as intended:

git checkout main
# Make Edit + stage
git commit
git quickfix --remove bugfix/fix1

The commit is removed from main and moved to bugfix/fix1. Running the above but not providing --remove, the commit stays on main.

In the original use case, there is no need (anymore) to run --onto develop, since develop can now be detected as the default branch.

from git-quickfix.

siedentop avatar siedentop commented on August 29, 2024

What are the steps that you were running?

I couldn't reproduce it, but I probably did something different to you. It would great if you could tell me the steps you followed.

chris@Christophs-MacBook-Air gitqf % git init
Initialized empty Git repository in /private/tmp/gitqf/.git/
chris@Christophs-MacBook-Air gitqf % echo "Line 1" > README.md
chris@Christophs-MacBook-Air gitqf % git add README.md; git commit -m "initial commit"
[master (root-commit) 862ef8f] initial commit
 1 file changed, 1 insertion(+)
 create mode 100644 README.md
chris@Christophs-MacBook-Air gitqf % git switch -c feature-x                          
Switched to a new branch 'feature-x'
chris@Christophs-MacBook-Air gitqf % echo "Line 2" >> README.md 
chris@Christophs-MacBook-Air gitqf % git commit -am "second commit on feature branch"
[feature-x 36d4577] second commit on feature branch
 1 file changed, 1 insertion(+)
chris@Christophs-MacBook-Air gitqf % echo "New file" > a_file.txt; git add a_file.txt
chris@Christophs-MacBook-Air gitqf % git commit -m "The quickfix commit"
[feature-x 1ac9103] The quickfix commit
 1 file changed, 1 insertion(+)
 create mode 100644 a_file.txt
chris@Christophs-MacBook-Air gitqf % git branch develop master
chris@Christophs-MacBook-Air gitqf % git quickfix readme-updates --onto develop
chris@Christophs-MacBook-Air gitqf % git log --oneline readme-updates
53b74f8 (readme-updates) The quickfix commit
862ef8f (master, develop) initial commit
chris@Christophs-MacBook-Air gitqf % git log --oneline -3 readme-updates
53b74f8 (readme-updates) The quickfix commit
862ef8f (master, develop) initial commit
chris@Christophs-MacBook-Air gitqf % git log --oneline
36d4577 (HEAD -> feature-x) second commit on feature branch
862ef8f (master, develop) initial commit

Git Reflog

chris@Christophs-MacBook-Air gitqf % git reflog
36d4577 (HEAD -> feature-x) HEAD@{0}: reset: moving to 36d457785461335c9318316c0f170135ff9fe8ce
1ac9103 HEAD@{1}: commit: The quickfix commit
36d4577 (HEAD -> feature-x) HEAD@{2}: commit: second commit on feature branch
862ef8f (master, develop) HEAD@{3}: checkout: moving from master to feature-x
862ef8f (master, develop) HEAD@{4}: commit (initial): initial commit

from git-quickfix.

msfjarvis avatar msfjarvis commented on August 29, 2024

It's just one repo of mine that's doing it, so I'm much more confused now :/

The source is at https://github.com/msfjarvis/compose-lobsters and I can repro the issue with a fresh clone as well. If for any reason you wish to introspect my local clone, here's a tarball of it.

I'm on Git version 2.30.1, if that's a factor.

from git-quickfix.

siedentop avatar siedentop commented on August 29, 2024

Interesting! I figured it out.

In your original description you write that "859ab94104e5 is the actual commit that I had on my develop branch and wanted to be moved." If you were indeed trying to do that, than you should use git quickfix differently. git qf readme-updates --onto develop moves the last commit on your current branch. But your current branch must not be the same as the branch supplied with --onto.

Steps (to replicate issue)

  1. git checkout develop
  2. Create commit
  3. git quickfix <new_branch> --onto develop. NOTE: develop is already the branch we are on.

Solution

I will update git quickfix to be clearer on this topic.

If you just want to move a commit away from develop and to a different branch, you can just reset develop by one commit. git reset --soft HEAD~1; git reset --hard (save the commit on the new branch first.)

Do you think git quickfix should handle this use case? (i.e. it would remove the commit from the current branch and start a new branch one commit below the current branch's history)

from git-quickfix.

msfjarvis avatar msfjarvis commented on August 29, 2024

I personally think this is a pretty standard use-case where you enter your repo, do a quick edit while on the default branch, then use git-quickfix to create a branch and start a pull request. So yeah, I'd definitely love to have git-quickfix support this in the manner you suggested :)

FWIW, I use --onto develop only because the hard-coded default branch candidates list does not include develop so if the manually provided argument is part of the problem then I can send a PR to expand the list.

from git-quickfix.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.