Hey everyone! I need some help with Git and GitHub. I'm an upper-level beginner when it comes to HTML and CSS, and I've managed to build a basic 5-page site. However, I've hit a wall with Git and GitHub that's really got me puzzled. I've spent over 20 hours trying to learn the basics, reading documentation, watching videos, and even playing some interactive games like Oh-my-git and learngit.js.org. I was able to push commits for my first project, but things got messy when I tried to add a second remote repository. Now I have branches and code mixed up between my different projects, and I can't figure out how to get back on track.
I think I grasp the concepts of push, pull, and commit, as well as the idea of creating branches. Yet, I struggle with how they all connect and impact each other, especially when dealing with remote repositories. For instance, how do I create a new branch on a remote repository without creating conflicting histories? My goal is to master the command line for Git before moving on to other topics, but I'm feeling a bit lost and would really appreciate some step-by-step guidance. Can anyone spare a moment to help me out?
2 Answers
You might want to check out GitBook to grasp the fundamentals. It's a great guide. Also, give learngitbranching.js.org another go! It helped me visualize Git commands a lot better, especially when I was learning about rebasing and merging. Just focus on a few key chapters—not the entire book—and practice as you go along.
It sounds like you're mixing up branches and repositories. Remember, branches are unique to each project. If you're having issues with different projects seeing each other's branches or code, you might have overlapping .git folders, which can happen if you mistakenly initialize Git in the wrong place. For now, try working locally before you worry about GitHub; focus on basic commands: creating branches, committing changes, merging, etc. Stick to experimenting on your personal repo until you feel comfortable!
Ah, so that's what overlapping .git files can do! I did that once too, so thanks for pointing it out! I need to be careful!
I just found that site! I love it, but I got confused with the 'head' part. I'm going back to review creating branches. Thanks for the suggestions!