Back to articles
Git Branches, Deleting, Diffing, and the Stuff That Actually Matters Day-to-Day

Git Branches, Deleting, Diffing, and the Stuff That Actually Matters Day-to-Day

via Dev.to BeginnersJalaj Bankar

One of those sessions that makes you genuinely more dangerous with Git. Not just knowing the commands but understanding why they work the way they do. This one's worth bookmarking. Push and Pull Only Talk to Their Associated Branch This is a common source of confusion early on. When you do git push or git pull on a branch, Git only communicates with that branch's associated remote — nothing else. git push newBranch goes to origin/newBranch and nowhere else. Same logic applies to pulling. If you want to pull from a different branch than the one you're on: git pull main or git pull origin main And to push your local branch up to the remote: git push origin Simple rule — if you're not being specific, Git assumes you mean the current branch's remote counterpart. git status and git log — Use Them Constantly Seriously, before doing anything in Git — git status. Before merging, before pushing, before deleting a branch. It takes one second and it tells you exactly where you stand. git log give

Continue reading on Dev.to Beginners

Opens in a new tab

Read Full Article
2 views

Related Articles