Git

From Worcester State University Computer Science Department Wiki
Revision as of 09:13, 1 February 2018 by Karl Wurst (Talk | contribs) (Git References)

Jump to: navigation, search

Git Cheat Sheet from GitHub

https://education.github.com/git-cheat-sheet-education.pdf

Git References

Difference between Fork and Clone

Fork-Clone-Diagram.png

Opening Git Bash (Windows) in a specific folder

You can open Git Bash directly in the folder where you have your code, rather than using the cd and ls commands to navigate there.

  1. Open the folder where you have your project.
  2. Right-click and choose Git Bash
  3. The terminal window will open and you will already be in that folder.

Opening Terminal (Mac OS X) in a specific folder

You can open Terminal directly in the folder where you have your code, rather than using the cd and ls commands to navigate there. You will need use Go2Shell[1] which you can download for free from the App Store.

Once you download is, hold down Command + Option and drag the icon from Applications to the toolbar at the top of any Finder window. That will install a button that looks like: >_< When you want to use it:

  1. Open the folder with your code in Finder.
  2. Click the Go2Shell button.
  3. The terminal window will open and you will already be in that folder.

Example .gitignore file

A .gitignore file is a hidden file that specifies which files should not be committed as part of a Git repository. Usually you don't want to commit editor temporary files, compiled code, binaries, files containing passwords, etc. Adding these files to your .gitignore file will allow you to do things like git add . and not worry about accidentally committing those files.

File:Example.gitignore a useful example .gitignore file. Needs to be renamed to .gitignore to be used.