💻
How to Use Project Development Tools in a Remote C
  • How to Use Project Development Tools in a Remote Coding Team
  • Trello
    • Introduction to Trello
    • How to use Trello
      • What is Trello?
      • Starting up a Trello Board
      • Lists
      • Cards
  • Visual Studio Code
    • Introduction to Live Share in Visual Studio Code
    • How to use Live Share
      • How to Install
      • How to Use
      • Examples of Use Cases
  • Git & Github - Basics
    • Introduction to Git & GitHub
    • How To Use Git
      • Setting up Git
      • Creating GitHub Repositories
      • Managing Repository Access
      • Syncing with a Local Workspace
  • How to Manage a Codebase with Git
    • Introduction to Branching
    • How To Use Branches
      • What are Branches?
      • Working in Branches
      • Merging Branches
      • Best Practices For Branching
    • Git Codebase Management Cheat Sheet
  • Conclusion
  • Team Biography
  • References
Powered by GitBook
On this page
  • Use Branches To:
  • The Best Practices Are:
  • Command Reference:
  • Additional Resources:

Was this helpful?

Export as PDF
  1. How to Manage a Codebase with Git

Git Codebase Management Cheat Sheet

Now that you know how to use branches, you can be more organized in your coding projects, especially those with more people on them where lots of different work is being done independently.

The branching and merging workflow, while useful, can be quite complicated, even for a Git veteran. Here is a cheat-sheet summarizing everything we have covered so that you can reference it when you need to remember how it all works:

Use Branches To:

  • Code independently on a team, with the same codebase

  • Store experimental features/buggy code somewhere for testing purposes without causing problems where the working/production code is

  • Group independent changes by feature to keep things organized, and selectively merge them into a production codebase (usually on master branch)

  • Communicate and organize with others

The Best Practices Are:

  • Group commits for features into new branches to keep things organized.

  • Make sure source branches are up to date and don’t have issues/bugs of their own

  • Maintain a branch with only working/production code

  • Delete old and merged branches unless there is a good reason not to

  • Prefer to use branching/merging features through GitHub's interface; it's easier and more organized

Command Reference:

  • git checkout <branch name> (switch to branch)

  • git checkout -b <branch name>(switch to branch, create beforehand if it does not exist. Current uncommitted changes are transferred)

  • git merge <source branch name> (merge branch into current branch)

  • git merge --continue (after resolving conflicts manually; recommended to do so on GitHub if possible)

  • git merge --abort(abort resolving a merge conflict manually)

Additional Resources:

PreviousBest Practices For BranchingNextConclusion

Last updated 4 years ago

Was this helpful?

Repo used for branching/merging example:

Git documentation for merging:

GitHub documentation for branches:

https://github.com/manderson0/Example-Merging
https://git-scm.com/docs/git-merge
https://docs.github.com/en/free-pro-team@latest/desktop/contributing-and-collaborating-using-github-desktop/managing-branches