Skip to content

inputdrive/cscj-22-project-git-the-boredless-tourist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Certainly! Git is a powerful version control system, but it's easy to make mistakes, especially when you're new to it. Let's explore some common Git mistakes and how to avoid or fix them:

  1. Committing Large and Unrelated Changes Together:

    • Mistake: Adding every changed file to a single commit can be tempting, especially after a long day of work.
    • Solution: Commit related changes together. Use descriptive commit messages to explain what each change does.
  2. Neglecting to Write Descriptive Commit Messages:

    • Mistake: Writing vague or generic commit messages like "Fix bug" or "Update code."
    • Solution: Provide meaningful commit messages that explain the purpose of the change. Be specific and concise.
  3. Ignoring .gitignore:

    • Mistake: Not using .gitignore to exclude files (such as build artifacts, logs, or temporary files) from version control.
    • Solution: Create a .gitignore file in your repository and list files or patterns to ignore.
  4. Not Cleaning Up Old Branches:

    • Mistake: Leaving old branches in your repository.
    • Solution: Regularly delete merged or obsolete branches to keep your repository clean.
  5. Using Force Push on Shared Branches:

    • Mistake: Force-pushing (with -f) can overwrite history and cause issues for collaborators.
    • Solution: Avoid force-pushing to shared branches. Use it only when necessary and communicate with your team.
  6. Storing Sensitive Information in the Repository:

    • Mistake: Committing secrets (such as API keys, passwords, or private keys) to the repository.
    • Solution: Use environment variables or a secrets manager. Remove sensitive data from commits.
  7. Storing Large Binary Files:

    • Mistake: Committing large binary files (e.g., images, videos, or compiled binaries).
    • Solution: Use Git LFS (Large File Storage) for large files. Keep your repository lightweight.

Remember, Git is a valuable tool, but understanding its features and best practices is essential for smooth collaboration and efficient development. 🚀

For more details, you can explore resources like Tower Blog², Coderwall³, and Komodor⁴. GitKraken¹⁵

Source: Conversation with Bing, 5/9/2024 (1) 7 Git Mistakes a Developer Should Avoid | Tower Blog. https://www.git-tower.com/blog/7-git-mistakes-a-developer-should-avoid/. (2) 7 Most Common Git Mistakes (Example) - Coderwall. https://coderwall.com/p/gkbexw/7-most-common-git-mistakes. (3) Common Git Errors, How to Fix, and 5 Ways to Avoid Them - Komodor. https://komodor.com/learn/git-errors/. (4) 7 (Deadly) Common Git Mistakes and How to Fix Them - GitKraken. https://www.gitkraken.com/blog/git-common-mistakes. (5) [AI] Avoiding (5) common Git mistakes in a team environment. https://dev.to/aneshodza/avoiding-5-common-git-mistakes-in-a-team-environment-1pm8.

About

codecademy cs project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages