Skip to content
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

Add "Switching Branches" section to "Managing Remote Repositories" documentation #33266

Closed
wants to merge 1 commit into from

Conversation

smngvlkz
Copy link

@smngvlkz smngvlkz commented May 31, 2024

This pull request adds a new section to the "Managing Remote Repositories" documentation. The new section covers how to switch branches in Git, which is a common task when working with remote repositories.

The new section includes:

How to switch to an existing branch
How to create a new branch and switch to it
How to check which branch you're currently on

Here's a brief overview of the changes:

Working with Remote Repositories

This guide will help you manage your local and remote repositories.

Adding a Remote Repository

...

Changing a Remote Repository's URL

...

Renaming a Remote Repository

...

Removing a Remote Repository

...

  • Switching Branches

  • To switch to an existing branch, use the git checkout command. This command needs the name of the branch you want to switch to.

  • Here's an example:

git checkout feature_branch
  • If you get an error saying "pathspec 'feature_branch' did not match any file(s) known to git", make sure you've typed the branch name correctly.

  • Creating and Switching to a New Branch

  • If you want to create a new branch and immediately switch to it, you can use the git checkout -b command. This command needs the name of the new branch.

  • Here's an example:

  git checkout -b new_feature_branch
  • This command will create a new branch called new_feature_branch and switch to it. If a branch with the same name already exists, you'll get an error saying "A branch named 'new_feature_branch' already exists".

  • Checking Which Branch You're On

  • To see which branch you're currently on, you can use the git branch command. The branch you're currently on will be marked with an asterisk (*).

  • Here's an example:

git branch
  • This command will list all the branches in your repository. The current branch will be marked with an asterisk (*).Source

Add instructions for switching branches in Git
Copy link

welcome bot commented May 31, 2024

Thanks for opening this pull request! A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.

@github-actions github-actions bot added the triage Do not begin working on this issue until triaged by the team label May 31, 2024
Copy link
Contributor

Automatically generated comment ℹ️

This comment is automatically generated and will be overwritten every time changes are committed to this branch.

The table contains an overview of files in the content directory that have been changed in this pull request. It's provided to make it easy to review your changes on the staging site. Please note that changes to the data directory will not show up in this table.


Content directory changes

You may find it useful to copy this table into the pull request summary. There you can edit it to share links to important articles or changes and to give a high-level overview of how the changes in your pull request support the overall goals of the pull request.

Source Preview Production What Changed
get-started/getting-started-with-git/managing-remote-repositories.md fpt
ghec
ghes@ 3.13 3.12 3.11 3.10 3.9
fpt
ghec
ghes@ 3.13 3.12 3.11 3.10 3.9

fpt: Free, Pro, Team
ghec: GitHub Enterprise Cloud
ghes: GitHub Enterprise Server

@nguyenalex836 nguyenalex836 added content This issue or pull request belongs to the Docs Content team waiting for review Issue/PR is waiting for a writer's review get started Content related to "Getting Started" doc set and removed triage Do not begin working on this issue until triaged by the team labels May 31, 2024
@nguyenalex836
Copy link
Contributor

@smngvlkz Thanks so much for opening a PR! I'll get this triaged for review ✨

@subatoi
Copy link
Contributor

subatoi commented Jun 4, 2024

Hi @smngvlkz, and thanks for taking the time to write this PR up. Unfortunately, we won't be accepting this contribution; I've outlined our reasoning below.

In this case, most of the content isn't specifically relevant to the article's subject "Managing remote repositories", and could apply more generally. We also need to be careful to strike the right balance and not overload new users (whom these articles target) with content about Git and GitHub respectively.

For situations like this (improvement suggestions, rather than bug fixes) we'd really encourage you to open an issue in this repository first, so we can discuss the best ways to move things forward, before going ahead and creating content.

Thanks again for your time, and we hope to see you with more contributions in future. You can always review those issues with approved help wanted labels under https://github.com/github/docs/issues

@subatoi subatoi closed this Jun 4, 2024
@smngvlkz smngvlkz deleted the patch-1 branch June 9, 2024 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content This issue or pull request belongs to the Docs Content team get started Content related to "Getting Started" doc set waiting for review Issue/PR is waiting for a writer's review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants