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

Intro to git lesson: git fetch branches from remote #158

Open
mwhosek opened this issue Jul 11, 2023 · 2 comments
Open

Intro to git lesson: git fetch branches from remote #158

mwhosek opened this issue Jul 11, 2023 · 2 comments

Comments

@mwhosek
Copy link
Collaborator

mwhosek commented Jul 11, 2023

In 2023 version of demo, I used "git pull origin newBranch" to pull down a branch newly created on the remote to the local repo. However, this is really dangerous because if the new remote branch has any changes, then those changes will be merged into the local branch that the user does the "git pull" command from! I missed this before because I didn't have any changes on the new remote branch before pulling it down.

The safer way to do this is to use "git fetch origin" on the local, and then you can git checkout to switch into it as normal. Be sure to fix and test before next year!!!

@semaphoreP
Copy link
Owner

My understanding is that git pull = git fetch + git merge so that is definitely strange.

@mwhosek
Copy link
Collaborator Author

mwhosek commented Jul 11, 2023

Yes, you're right, never mind my earlier confusion. I think using git fetch is the way to go in the future.

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

No branches or pull requests

2 participants