this post was submitted on 29 Jun 2023
440 points (98.9% liked)

Git

2632 readers
1 users here now

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Resources

Rules

  1. Follow programming.dev rules
  2. Be excellent to each other, no hostility towards users for any reason
  3. No spam of tools/companies/advertisements. It’s OK to post your own stuff part of the time, but the primary use of the community should not be self-promotion.

Git Logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported License.

founded 1 year ago
MODERATORS
440
Your Git horror stories (programming.dev)
submitted 1 year ago* (last edited 1 year ago) by [email protected] to c/[email protected]
 

We all have been there... For the beginner it's easy to mess things up. What are your horror stories with Git?

Link to xkcd

you are viewing a single comment's thread
view the rest of the comments
[–] mookulator 3 points 1 year ago* (last edited 1 year ago)

It’s ridiculous isn’t it? You shouldn’t have to feel like you’re learning some cryptic new language to use version control software.

Just do a really simple work flow:

  1. “Clone” the code repository from the internet onto your computer (“clone” = “copy”). You only do this once.
  2. Edit code like normal
  3. When you feel happy with some changes you’ve made, “commit” them (“commit” = “save”)
  4. When you’ve committed a few changes, “push” them back to the original repository so your coworkers can see your changes (“push” = “publish”) Repeat

There are a few good practices:

  • “Pull” often. I.e. update your local copy of the repository with your coworkers’ changes
  • Write an intelligible message with every commit so you and your coworkers can understand what you changed
  • If you’re going to take on a big project, make a “branch” and work there. A branch is like a copy within a copy of the repository so you don’t mess with code that’s already working. When you’re happy with a bunch of commits/pushes in a branch, you “merge” it back into the main repository.

Everything else is just details!