Using Git and GitHub - bounswe/bounswe2022group7 GitHub Wiki

This page includes some resources which can be used to learn more about Git and GitHub.

Using GitHub integration on Slack:

What is Git and GitHub?

Git is a distributed revision control system for editing and keeping track of all kinds of documents, although it is mainly used for source control management. It is distributed in the sense that you don't need to have a central place to coordinate the revisions of documents edited by different people. Everyone who is involved in the editing process have the full repository in their possession. In practice, however, people prefer to have a central remote repository to coordinate their work. This is where GitHub and other similar platforms come into play.

GitHub and other hosting platforms for repositories extend the capabilities of git by providing users with rich and easy-to-use tools for their development workflows. They make collaboration and discussions easier and increase the productivity of teams.

A typical workflow on GitHub starts with creating a repository to be the central place for coordinating the development process. This remote repository is known as "origin" when cloned to a local machine. It has a "main" branch which is typically the ultimate product branch of a development process. Members of a team who work on their local machines create branches when they want to extend the functionality of their main branch or fix the bugs they or their users discovered. Creating branches are very cheap in git in terms of efficiency and therefore encouraged. After a developer is done with their local branch, they send it to the remote origin repository and create a pull request for the changes to be reviewed by others and ultimately incorporated to the main branch.

Most Common Git Commands

  • git clone <repository url> is used to download the latest version of the existing repository. Use this command git clone <repository url> -b <branch name> to clone the specified branch.
  • git fetch is used to get the latest updates.
  • git checkout <branch name> is used to switch between branches.
  • git init <repository name> is used to create a new empty repo or reinitialize the previously created repository.
  • git commit -m "<commit message>" is used to commit all staged files to the repository, which is like a snapshot of the repository.
  • git push is used to commit local changes to the remote branch.
  • git pull is used to fetch and merge the latest updates from the remote repo.
  • git add <file path> is used to stage changed files.
  • git branch is used to list all the branches of the repo.

References

⚠️ **GitHub.com Fallback** ⚠️