BME554L - Fall 2025
Duke University
August 25, 2025
git?git?remote), you have a few ways to start things:clone it to your local computer.my_first_git_repo.
+ icon in the upper left :arrow_right: New project/repositoryCreate Blank Projectmy_first_git_repoWarning
If this is a new repository that doesn’t already exist locally on your laptop, then you can choose to have GitLab create a README.md file; otherwise, deselect that default option.
Create Projectpush and pull commands.)Git tools in VS Code, but I recommend you do it on the commandline so you can see what is happening.$; that indicates that this is a command you would enter in your Terminal or Git Bash session.README.md file when you created the repository..git/ directory will be created that stores all version historyOnce you have a local git repository, either through cloning or initializing one, you can start working on your project. All of the following commands are valid when you are “inside” your project directory (root level or deeper). You can also execute all of these commands natively within VS Code (and more elegantly with GitLens within VS Code).
git status frequently to keep track of what you are doing. VS Code will show you the status “live” in the bottom left corner of the window.git track?git will only track files that you explicitly tell it to track.git stage is a direct alias for git add. VS Code’s GitLens will use the term “stage” instead of “add”.Warning
While it is valid syntax to add an entire directory as git add . or to use wildcards to add mutliple files by a common pattern using git add *_SOME_PATTERN, I recommend you explicitly add files one at a time to avoid accidentally adding files you don’t want to track.
-m option to enter a one-line commit message on the commandline.git log, you thank your past self for knowing what and when you edited.| Bad Commit Message | Good Commit Message |
|---|---|
| fixed issue | Fixed GND pour on my PCB to ensure DRC checks pass |
| added function | edited arduino code to user timers instead of sleep |
| boom | if you’re right at the deadline, this one is understandable |
| updated piece | updated CAD render for H3 neck to be at 75deg angle |
.gitconfig.lg alias, you will see a “prettier” version of the output using git lg.git to manageUntracked if they are never added..gitignore.
add and commit it!/ at the end of the name to indicate a directory name.* as a wildcard to any characters in the name pattern match..gitignore:Live demo time!
git push)git pull)Important
You will always need to pull the latest commits from a repository before you push anything new.
main.Note
Some older versions of git used a default name of master, but that has been deprecated.* If your configuration is still using master, please consider changing the default branch name.
main.main (or another branch) when they are “ready”.$ git branch BRANCHNAME # this creates a new branch
$ git checkout BRANCHNAME # this switches to the branchgit checkout.git switch achieves the same behavior when swiching between branches.functionality-in-my-project.dev-calc-ecg-hr.main.origin with the same name as the local branch:.gitconfig file, but if not:merge your changes back into your main branch (or another branch).Tags are simply meaningful “names” to associate with specific git commits.origin. That name is arbitrary, but widely used.git@ use SSH keys to authenticate you.If your Mac terminal doesn’t have tab autocompletion enabled when typing out your long branch name you created among other git commands, follow the steps from this link.
This will only work in your Mac terminal. If you’d like to enable this in VS Code as well, open up your preferences with Cmd + ,, and then navigate through this:
User -> Extensions -> Git.Terminal Git Editor and check this box.