pcottle / learnGitBranching

An interactive git visualization and tutorial. Aspiring students of git can use this app to educate and challenge themselves towards mastery of git!
https://pcottle.github.io/learnGitBranching/
MIT License
30.61k stars 5.75k forks source link

Support `git pull --rebase origin some-branch` #1004

Closed drmercer-lucid closed 2 years ago

drmercer-lucid commented 2 years ago

Expected behavior: this sequence of commands works:

git clone
git fakeTeamwork
git commit
git pull --rebase origin main

Actual behavior:

$ git clone

local branch "main" set to track remote branch "o/main"

$ git fakeTeamwork

$ git commit

$ git pull --rebase origin main

main is not a remote in your repository! try adding origin to that argument

Note: omitting the last two arguments to git pull --rebase works as expected, and git pull origin main (i.e. without rebase) works to do a merge-pull. So I think there's a specific problem with parsing the <repository> and <branch> arguments when --rebase is supplied.

pcottle commented 2 years ago

yeah let me check -- dropping just one argument works too: https://learngitbranching.js.org/?NODEMO&command=git%20checkout%20-b%20foo;%20git%20clone;%20git%20fakeTeamwork%20foo;%20gc;%20git%20pull%20--rebase%20foo

pcottle commented 2 years ago

this is due to my incredibly horrible argument parsing logic that attaches origin to the --rebase option rather than including it in general args :P

added a test for now!