Git and GitHub Tutorial: How to use Git and GitHub
Introduction: 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. There are different Git interfaces, frontends, and tools. GitHub is a web-based Git repository hosting service, and it offers all distributed revision control and source code management (SCM) functionalities of Git as well as adding its own features.
Table of Contents:
- Git download and usage
- GitHub Desktop
- GitHub for OBO Foundry
- Learn Git with Bitbucket
- TortoiseGit
- GITWeaver: Dreamweaver GIT
- Comparison between Git and SVN
- Useful web links
--------------------
1. Git download and usage:
(1) Git download: https://git-scm.com/downloads
Git comes with built-in GUI tools such as git-gui and gitk. In addition, there are several third-party tools for users looking for a platform-specific experience: https://git-scm.com/downloads/guis.
https://www.atlassian.com/git/tutorials/install-git :
(2) Git usage:
- Git tutorial provided by git-scm.com: http://git-scm.com/docs/gittutorial
(Note: This very good tutorial explains how to import a new project into Git, make changes to it, and share changes with other developers. To get more information, type "git help log").
2. GitHub Desktop:
2.1. GitHub workflow: https://guides.github.com/introduction/flow/ (PDF version)
Note: basically, the workflow is: Create a branch --> Add commits --> Open a Pull Request --> Discuss and review your code --> Deploy --> Merge.
2.2. Download: Installation is easy. go to desktop.github.com and click the big blue button that says “Download GitHub Desktop.” Follow the direction. Once you install, you’ll notice a GitHub icon and a Git Shell Icon on your desktop.
See more installation help: https://help.github.com/desktop/guides/getting-started/installing-github-desktop/
By default, the Git Shell shortcut launches Windows PowerShell with Git set up. As illustrated in the Microsoft PowerfShell , we can start the PowerShell by: Click Start, type PowerShell, and then click Windows PowerShell. However, the default Powershell may not recoganize Git. In this case, we can just click the "GitShell' to use the git commands.
2.3. GitHub Client simple usage tutorial:
2.4. Common Git commands avaialble in Gitshell:
start a working area (see also: git help tutorial)
- clone Clone a repository into a new directory
- init Create an empty Git repository or reinitialize an existing one
work on the current change (see also: git help everyday)
- add Add file contents to the index
- mv Move or rename a file, a directory, or a symlink
- reset Reset current HEAD to the specified state
- rm Remove files from the working tree and from the index
examine the history and state (see also: git help revisions)
- bisect Use binary search to find the commit that introduced a bug
- grep Print lines matching a pattern
- log Show commit logs
- show Show various types of objects
- status Show the working tree status
grow, mark and tweak your common history
- branch List, create, or delete branches
- checkout Switch branches or restore working tree files
- commit Record changes to the repository
- diff Show changes between commits, commit and working tree, etc
- merge Join two or more development histories together
- rebase Forward-port local commits to the updated upstream head
- tag Create, list, delete or verify a tag object signed with GPG
collaborate (see also: git help workflows)
- fetch Download objects and refs from another repository
- pull Fetch from and integrate with another repository or a local branch
- push Update remote refs along with associated objects
'git help -a' and 'git help -g' list available subcommands and some concept guides. See 'git help <command>' or 'git help <concept>' to read about a specific subcommand or concept.
2.5. More GitHub tutorials:
3. GitHub for OBO Foundry projects:
Tutorial:
4. Learn Git with Bitbucket:
Tutorial:
5. TortoiseGit:
TortoiseGit download: https://tortoisegit.org/
TortoiseGit usage:
6. GITWeaver: Dreamweaver GIT
Download: https://github.com/ChrisMcKee/gitweaver
Usage: GITWeaver is a Dreamweaver Extension that hooks DreamWeaver into TortoiseGIT. Using it is the same as using TortoiseGIT but from inside Dreamweaver.
7. Comparison between Git and SVN
See: http://stackoverflow.com/questions/871/why-is-git-better-than-subversion
Quote:
"In the most simplistic usage, Subversion and Git are pretty much the same. There is not much difference between:
svn checkout svn://foo.com/bar bar cd bar # edit svn commit -m "foo"
and:
git clone git@github.com:foo/bar.git cd bar # edit git commit -a -m "foo" git push
Where Git really shines is branching and working with other people."
More: https://git.wiki.kernel.org/index.php/GitSvnComparison
8. More useful web links:
|