2025-12-20

beginner introduction to git

git is fundamentally a database in which file contents are stored in compressed form at specific points in time based on their content hashes. it is decentralized, because every copy of a repository can function as a fully capable server. when several people work on the same files, git can automatically resolve many conflicts and reliably merge changes. versioning facilitates documented, traceable changes, parallel work, an overview of modifications, and reverting to functioning states.

commands

the following commands belong to the most important basics when working with git daily.

git init initializes a new git repository in the current directory.

git clone downloads an existing repository and creates a local copy.

git status displays the state of the working directory, index, and current commit.

git diff compares unindexed changes with the last commit.

git add adds changes to the index so they become part of the next commit.

git reset removes indexed changes from the index without altering the files.

git commit creates a new commit from the current index.

git log displays the commit history.

git checkout reverts files, retrieves them from old commits, or switches a branch.

git pull fetches new commits from the remote and integrates them into the local history.

git push transfers local commits to the remote.

git branch lists existing branches.

typical calls

git init
git clone 
git status
git diff
git add 
git reset
git commit
git log
git checkout 
git pull
git push
git branch

explanations

branch a parallel line of development that can be merged with other branches.

new branches can be created with git checkout -b and switched with git checkout .

commit a saved and versioned state of the index.

ignoring files add paths to a .gitignore file. the file applies to the directory and its subdirectories where it is located.

https vs. ssh https uses a password or token for authentication, while ssh uses an ssh connection. ssh is usually more convenient with frequent use.

index the collection of all changes that are to be included in the next commit.

configuration with the command git config, configuration can be performed locally in the repository and globally. for example, the initial user and email used in commit messages.

git config --global user.name ""
git config --global user.email ""

remote an external storage location for the repository, for example on a server.

links