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 git branch and git checkout Commands #87677

Open
yehiarasheed opened this issue Aug 18, 2024 · 4 comments
Open

Add git branch and git checkout Commands #87677

yehiarasheed opened this issue Aug 18, 2024 · 4 comments

Comments

@yehiarasheed
Copy link
Contributor

I noticed that in the README.md, you explained git branching using git switch branch-name instead of git branch branch-name then git checkout branch-name

🐞 Problem
I'm proposing that we add using git branch branch-name then git checkout branch-name as an additional explanation or option (feature) so that the project may provide a fuller description.

🎯 Goal
This change is important to me to provide first-time contributors with actual Git knowledge, especially that GUIs for Git even in IDEs such as IntelliJ for example and other platforms rely and explicitly list checkout as an option, which the contributors would not understand after contributing to the post. Although I do agree that git switch branch-name is indeed simpler and quicker for new contributors to learn but adding the two other git commands would not hurt the core of the project.

@Esh07
Copy link
Contributor

Esh07 commented Aug 20, 2024

Youp. Back in days it was powerful to do it like that way as you referring this https://stackoverflow.com/a/7987711.

but why make doc more longer when we have updated command to make process little faster 😄 .

Good Read

Git switch and git checkout are both used to change branches, but they have some differences in syntax and behavior. Git switch is a newer command that is more focused on branches, while git checkout is an older command that can do other things besides switching branches.

Git checkout has a more versatile syntax than git switch, but it can also be more confusing and error-prone if you don’t understand its behavior.

https://kodekloud.com/blog/git-switch-vs-checkout/

@yehiarasheed
Copy link
Contributor Author

Good read I agree, I also think we shouldn't make the docs longer so that it isn't intriguing for new contributors. However, we should at least inform them with the term branching and that checking out is another term for switching so that they are more ready to go contribute and work with IDEs and their terminology straight after using the repo, if you know what I mean. Even in one additional line or something so that the docs aren't longer but it is something they should know as a term.

@Habeebah157
Copy link
Contributor

Hello,
I agree with you, I think it could help beginners understand what the git switch actually does. I was thinking something like this:
To create a new branch, use the following command:

git branch branch-name

After creating the branch, switch to it with:

git checkout branch-name

Alternatively, you can create and switch to a new branch in one step using the git switch command:

git switch -c your-new-branch-name

.

@yehiarasheed
Copy link
Contributor Author

yehiarasheed commented Aug 22, 2024

Hello @Habeebah157, I'm happy that you agree with the concept and if you check the commits I made in PR #87678 you'll see that I did the exact same thing except that I reversed it so that the switch command is right on top and if a beginner wants to go to the git branch branch-name then git checkout branch-name then they go for the second option which I made obvious using a H3 in Markdown. Again, your implementation is great since it actually takes them to do the basic commands and then they learn the newer, easier command which I agree with to be honest. Check out my version here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants