git-xargs icon indicating copy to clipboard operation
git-xargs copied to clipboard

Bugfix checkouting existing branch. Fixes issue #109

Open navrkald opened this issue 1 year ago • 1 comments

Description

Fixes #109.

Original code did equivalent of following:

git clone <some repo>
git checkout -b <branch name>
git merge --ff origin/<branch name>

new code is properly checkouting remote branch if exists

git clone <some repo>
git fetch
# Try to checkout remote branch
git checkout <branch name>
# If above command fails then new branch is created
git checkout -b <branch name>

Problem with original code is not only that's not convenient, but it's as well bugy, it's silently supposing that <branch name> was created on top of default remote branch name plus it's supposing remote branch name haven't changed in meanwhile until remote <branch name> was created. Ofc this conditions are often not met and thats the case when the bug #109 appears.

TODOs

Read the Gruntwork contribution guidelines.

  • [x] Update the docs.
  • [x] Run the relevant tests successfully, including pre-commit checks.
  • [x] Ensure any 3rd party code adheres with our license policy or delete this line if its not applicable.
  • [X] Include release notes. If this PR is backward incompatible, include a migration guide.

Release Notes

Fixed #109 checkout remote branch locally if exists.

navrkald avatar Feb 14 '24 21:02 navrkald

Hi @brikis98 , @hongil0316 It's been 2 months since creation of this PR. Can you please review?

navrkald avatar Apr 18 '24 14:04 navrkald