Skip to content

Add git switch command #114330

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

jeanp413
Copy link
Contributor

This PR fixes #114066

: localize('select a ref to switch', 'Select a ref to switch'))
: (opts?.detached
? localize('select a ref to checkout detached', 'Select a ref to checkout in detached mode')
: localize('select a ref to checkout', 'Select a ref to checkout'));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit-pick: There is a fair bit of string repetition here. Suggested resolution:

const action = opts?.command === 'switch' ? 'switch' : 'checkout';
quickpick.placeholder = opts?.detached
				? localize(`select a ref to ${action} detached', 'Select a ref to ${action} in detached mode`)
				: localize(`select a ref to ${action}', 'Select a ref to ${action}`));
			

const force = localize('force', "Force Checkout");
const stash = localize('stashcheckout', "Stash & Checkout");
const choice = await window.showWarningMessage(localize('local changes', "Your local changes would be overwritten by checkout."), { modal: true }, force, stash);
const message = opts?.command === 'switch' ? localize('local changes switch', "Your local changes would be overwritten by switch.") : localize('local changes checkout', "Your local changes would be overwritten by checkout.");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit-pick: Same suggestion here:

const action = opts?.command === 'switch' ? 'Switch' : 'Checkout';
const message = localize(`local changes ${action}`, "Your local changes would be overwritten by ${action}.`);
const force = localize(`force${action.toLowerCase()}`, `Force ${action.toLowerCase()}``);
const stash = localize(`stash${action}`, `Stash & ${action}`);

const choice = await window.showWarningMessage(localize('local changes', "Your local changes would be overwritten by checkout."), { modal: true }, force, stash);
const message = opts?.command === 'switch' ? localize('local changes switch', "Your local changes would be overwritten by switch.") : localize('local changes checkout', "Your local changes would be overwritten by checkout.");
const force = opts?.command === 'switch' ? localize('forceswitch', "Force Switch") : localize('forcecheckout', "Force Checkout");
const stash = opts?.command === 'switch' ? localize('stashswitch', "Stash & Switch") : localize('stashcheckout', "Stash & Checkout");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit-pick: The difference use of single and double quotes on the above to line (BTW: I am not sure on what the project coding standard / linting enforces here)

@joaomoreno joaomoreno changed the base branch from master to main February 15, 2021 08:51
@lszomoru lszomoru assigned lszomoru and unassigned eamodio Oct 4, 2021
@joaomoreno joaomoreno added the git GIT issues label May 2, 2022
@lszomoru lszomoru mentioned this pull request Jan 11, 2023
@lszomoru lszomoru modified the milestones: January 2023, Backlog Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
git GIT issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Git - Add "Git: Switch to…" as an alias for "Git: Checkout to…"
5 participants