Giter Site home page Giter Site logo

git-workspace's Introduction

Setting Up Your Git Workspace

This repo is inspired by a free online course from Udacity, How to Use Git and Github by Caroline Buckey and Sarah Spikes. Check out the course here: https://www.udacity.com/course/ud775. This course was designed as part of a program to help me and others become Front-End Developers. You can check out the full details of the program here: https://www.udacity.com/course/nd001.

If you take your time to configure a few things about Git, it can be much easier and more pleasant to work with. This includes having a colourful custom prompt that shows the commit that is currently checked out, and if there are any changes in the repo, having tab completion for git commands and setting your prefered editor for editing commit messages.

Watch this video from the course

Git Workspace

Disclaimer: I have made a few personal modifications to these instructions, for the original instructions, please refer to the course on the Udacity website. (Plus, I included the videos from the course in the repo, just incase they are pulled down in the future)

Setting Up Your Workspace on Windows

Download the necessary files

  • Download the three files git-completion.bash, git-prompt.sh and bash_profile from the windows folder in this repo, and save them in your home directory with the same names.
  • If you already have a file in your home directory named .bash_profile, copy the content from the bash_profile file that you downloaded and paste it at the bottom of your existing .bash_profile file. Otherwise, rename the bash_profile file that you downloaded to .bash_profile (with a dot at the beginning) and save it in your home directory.

(If you're curious to learn more about how bash prompts work, see this page.)

Making Git configurations

Run the following Git configuration commands. The first one will need to be modified if you are using a text editor other than Sublime, or if Sublime is installed in another location for you. See this page for the correct command for a couple of other popular text editors. For any other editor, you'll need to enter the command you use to launch that editor from Git Bash.

git config --global core.editor "'C:/Program Files/Sublime Text 2/sublime_text.exe' -n -w"
git config --global push.default upstream
git config --global merge.conflictstyle diff3

Make sure you can start your editor from Git Bash

If you use Sublime, you can do this by adding the following line to your .bash_profile:

alias subl="C:/Program\ Files/Sublime\ Text\ 2/sublime_text.exe"

Restart Git Bash

You'll need to close and re-open Git Bash before all your changes take effect.

Watch this video from the course

Setting Up Your Workspace on Windows

Setting Up Your Workspace on Mac and Linux

Download the necessary files

  • Download the three files git-completion.bash, git-prompt.sh and bash_profile from the mac-or-linux folder in this repo, and save them in your home directory with the same names.
  • If you already have a file in your home directory named .bash_profile on mac (or .bashrc on linux), copy the content from the bash_profile file that you downloaded and paste it at the bottom of your existing .bash_profile file on mac (or .bashrc on linux). Otherwise, rename the bash_profile file that you downloaded to .bash_profile on mac (or .bashrc on linux) (with a dot at the beginning) and save it in your home directory.

(If you're curious to learn more about how bash prompts work, see this page.)

Make sure you can start your editor from the terminal

If you use Sublime, you can do this by adding the following line to your .bash_profile on mac (or .bashrc on linux) (you may need to change the path if Sublime is installed in a different location for you):

alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"

Making Git configurations

Run the following Git configuration commands. The first one will need to be modified if you are using a text editor other than Sublime, or if Sublime is installed in another location for you. See this page for the correct command for a couple of other popular text editors. For any other editor, you'll need to enter the command you use to launch that editor from Git Bash.

git config --global core.editor "'/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl' -n -w"
git config --global push.default upstream
git config --global merge.conflictstyle diff3

(Instead of the first command, you may be able to use the simpler git config --global core.editor "subl -n -w" as shown in the video, but many students have found this does not work for them.)

Restart the terminal

You'll need to close and re-open the terminal before all your changes take effect.

Watch this video from the course

Setting Up Your Workspace on Mac

Acknowledgments

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.