-
Notifications
You must be signed in to change notification settings - Fork 7
A Quick Guide to Git and GitHub
“Git is a free and open source distributed version control system.” as stated in their own website. It is a complicated definition so let’s do some explaining. The free and open source part is easy. It is free to download and you can access the source code here: https://github.com/git/git. There are more than 1200 contributors currently.
A version control system is basically a system where you have access to every version of your code. This is particularly important since as you make changes in your code you may have to deal with some bugs that occur because of your changes. If they become unfixable you may have to return to the previous version and with Git this is really simple.
What about the significance of distributed? Well unlike a centralized version control system where people can only make changes in the master branch, in a distributed system contributors of the project will pull the current version of the program and make changes locally and then push the project back to a remote branch to test the updates and check if they are bug-free. And this branch will be merged with the master branch only if it is proven to work. This way the current project will not be affected by a buggy code piece pushed by a contributor and everyone can work on the latest stable version of the code which saves time.
Then we come to another question:
The project which is being managed by Git needs to be hosted on a server or computer and Github is solving this problem. So basically GitHub is a Git repository hosting service.
The issue feature in GitHub is useful for making people aware of detected bugs, proposing some improvements or just discussions. When the code is being updated, the coders can open a branch and do the changes there without affecting the original code. Then when the update is done you can open a pull request to show the changes you did to your team members and discuss them. If everyone is happy with the new version you can merge the pull request and this way your code will run smoothly without any disturbance while updating.
These are what makes Git and GitHub popular among coders.
Before you start using the Git, you need to install the Git software. Go to this download page and install the right version for your machine. Just follow the instructions, it is like installing any other software. After you install Git successfully, go to your operating system's search bar, write "Git Bash" and start the command line interface. That's all, now you have the Git.
git config --global user.name "[name]"
Sets the name you want to be attached to your commit transactions
git config --global user.email "[email address]"
Sets the email you want to be attached to your commit transactions
git init [project-name]
Creates a new local repository with the specified name
git clone [url]
Downloads a project and its entire version history
git status
Lists all new or modified files to be committed
git diff
Shows file differences not yet staged
git add [file]
Snapshots the file in preparation for versioning
git commit -m "[descriptive message]"
Records file snapshots permanently in version history
git branch
Lists all local branches in the current repository
git branch [branch-name]
Creates a new branch
git checkout [branch-name]
Switches to the specified branch and updates the working directory
git merge [branch]
Combines the specified branch's history into the current branch
git branch -d [branch-name]
Deletes the specified branch
git log
Lists version history for the current branch
git diff [first-branch]...[second-branch]
Shows content differences between two branches
git show [commit]
Outputs metadata and content changes of the specified commit
git fetch [bookmark]
Downloads all history from the repository bookmark
git merge [bookmark]/[branch]
Combines bookmark's branch into current local branch
git push [alias] [branch]
Uploads all local branch commits to GitHub
git pull
Downloads bookmark history and incorporates changes
git reset [commit]
Undoes all commits after [commit], preserving changes locally
git reset --hard [commit]
Discards all history and changes back to the specified amount
* This commands and explanations are taken from the official Git Cheat Sheet.
- Requirements
- Mockups
- User Types
- Personas, User Stories and Acceptance Criteria
- Use Case Diagrams
- Class Diagram
- Sequence Diagrams
- Milestone Report #1
- Project Plan
- System Manual
- User Manual
- TrAiders Annotation Server