YouTube Video of the seminar: https://youtu.be/ap7rqcD8uPs
Thanks to everyone who was able to attend! --KS
Be sure to install Git version 2.30.0 or higher.
A lot of developer technologies require XCode’s command-line tools, but they are useful in their own right. To install them, you’ll need to pull up the Terminal app on your Mac. The easiest way to do this is through Spotlight Search: click the magnifying glass in the upper right-hand corner of your Mac, and start typing
Terminal; click the result that appears labeled as an Application.
You’ll have a small white window that pops up, with a line that most likely has the name of your computer followed by a colon, tilde, and dollar-sign, e.g.,
janes-mac:~ $. There’ll also be a cursor, which may or may not blink.
xcode-select --install (note the space before the two hyphens) and hit the Return/Enter key. (You might be prompted for your admintrator password.) You should see a some output fly by, unless you've installed XCode previously. In that case, you'll get an error informing you that your command-line tools are already installed. Once the script has finished running and you see the dollar-sign prompt again, type
git version and press return. You should see
git version 2.30.1 (Apple Git-130), or a similar number, output in the Terminal window.
To easily install the very latest version of Git, follow the instructions below for installing Homebrew and then run:
$ brew install git
Don't forget to configure Git once you've got the latest version installed.
Download the Windows installer for Git and double-click the downloaded file’s icon to install it; it’ll probably be in your Downloads folder.
Walk through the Git Setup Wizard, making the following changes from the defaults:
Git Setup will then complete the installation; it takes a few minutes. Click Finish when it's done.
Look for the
git-bash icon on your desktop. Double-click it, and type
git version into the terminal window that opens. You should see output like
git version 2.32.0 or some similar number.
If you're running Linux, Git may already be on your system. Run
git version in your terminal shell to see if there's any output. If you get a "Command not found" error, Google around for the preferred method to install or compile Git on your Linux distribution, preferably with its package manager so you automatically receive updates along with the rest of your system.
You'll need to open a terminal window (MacOS/Linux) or a Windows shell (Windows), and type the following commands. Replace YOUR NAME and YOUR@EMAIL with the actual name and email you use.
$ git config --global user.name "YOUR NAME" $ git config --global user.email "YOUR@EMAIL"
When you've run those commands, run
git config --global --list and you should see your name and email. If you do not, re-run the commands above to fix any mistakes you've made.
As of Git 2.28.0, it is essential to configure Git to use a custom default branch name. The default branch had been
master, which Git, GitHub, and the wider industry are moving away from because of its historically racist connotations.
main is now the preferred name for the default branch, and we will use that in this course. To set
main as your default branch for all new repositories that you create, simply run:
$ git config --global init.defaultBranch "main"
If for whatever reason you cannot install at least Git 2.28.0, your best bet is to create an alias for yourself, such as
git new, which you will need to use in place of
$ git config --global alias.new '!git init && git symbolic-ref HEAD refs/heads/main'
If you have old repositories that you'd like to convert from
main, check out this excellent post's instructions.
Finally, you need to tell Git which merge strategy to use in case you end up interacting with a remote branch that has changes you don't yet have locally--and local changes that are not yet on the remote.
To start with, you can tell Git to use the default merge strategy:
$ git config --global pull.rebase false
Eventually, you'll remove that value and set
only instead, but we'll cover that in the Git seminar. Go with
pull.rebase for now.
Once you've done all of that configuration, check that you've set everything correctly by running:
$ git config --global --list
You'll see output for each of your configuration values. If you've made any mistakes, just rerun the
git config --global commands above with the correct value.
Join Karl Stolley, Associate Professor of Information Technology and Management, for a fun and lively hands-on Git seminar on Thursday, January 20, 2022 from 7pm to 9pm CST (America/Chicago). Whether you're brand-new to Git or a seasoned user, this seminar has something for everyone: You'll tune your Git configuration to suit your workflow and development environment. You'll learn how to expertly craft atomic commits by leveling up on your diffing abilities and writing your commits in a professional style. You'll gain confidence in collaborating with others using remote repositories hosted on GitHub and elsewhere, and you'll discover techniques for organizing your work and experimenting across multiple branches. You'll also learn how to effortlessly manage the trickier sides of Git, including reconciling divergent branches, fixing merge conflicts, and rewriting a repository's history before you share your work with the rest of the world.
Git part of three essential development skills: documentation, testing, and version control.
git switch -c
mainbranch (or whatever your default is)
main, other longer-lived dev branches
git merge(public; ff only)
git diffto catch conflicts before they happen