Skip to content

Instantly share code, notes, and snippets.

@AliciaMoses
Created July 3, 2024 11:16
Show Gist options
  • Select an option

  • Save AliciaMoses/e75a66d95925c03d66433a36d0ee5cdb to your computer and use it in GitHub Desktop.

Select an option

Save AliciaMoses/e75a66d95925c03d66433a36d0ee5cdb to your computer and use it in GitHub Desktop.

Git workshop - Local Code-along

1. Let's set up our project and create a new repository

cd projects 
mkdir git-internals
cd git-internals

git init

You should see:

Initialized empty Git repository..

2. Let's check the current status

git status

On branch main No commits yet nothing to commit (create/copy files and use "git add" to track)

3. Let's look at the directory

ls -a 
cd .git
ls -R
HEAD        config      description hooks       info        objects     refs
./hooks:
applypatch-msg.sample     fsmonitor-watchman.sample pre-applypatch.sample     pre-merge-commit.sample   pre-rebase.sample         prepare-commit-msg.sample sendemail-validate.sample
commit-msg.sample         post-update.sample        pre-commit.sample         pre-push.sample           pre-receive.sample        push-to-checkout.sample   update.sample
./info:
exclude

./objects:
info pack

./objects/info:

./objects/pack:

./refs:
heads tags

./refs/heads:

./refs/tags:
cd ..

Current repository is empty - in that there is no history stored yet

We can use git to help us find commands and understand how it works

4. Let's look up git's helper commands

git 
git help -a
git help -g

# use q to quit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment