git init
git initTurns your plain folder into a Git repository so you can start saving code history.
Initializes a new Git repository.
Search for what you want to do, or browse the official Git commands organized by workflow.
16 commands
git initTurns your plain folder into a Git repository so you can start saving code history.
Initializes a new Git repository.
git clone <url>Downloads a full project from GitHub to your computer so you can work on it.
Downloads a project and its entire version history.
git statusTells you which files you've changed, which are ready to be saved, and which are untracked.
Lists all new or modified files to be committed.
git logA time machine that shows you every save (commit) made in this project's history.
Shows the commit history for the currently active branch.
git add <file>Tells Git: 'I want to include this specific file in my next save.'
Stages a specific file for the next commit.
git add .Tells Git: 'I want to save ALL the changes I just made.'
Stages all changed files for the next commit.
git commit -m "message"Takes a picture of your staged files and saves them permanently with a message describing what you did.
Records a snapshot of the staging area.
git remote add origin <url>Tells your computer where your GitHub repository lives on the internet.
Connects your local repository to a remote server.
git push origin mainSends your saved commits from your computer up to GitHub for everyone (or just you) to see.
Uploads local branch commits to the remote repository.
git pullDownloads any new changes from GitHub and immediately mixes them into your local files.
Fetches and merges changes on the remote server to your working directory.
git branchShows you all the different timelines (branches) in your project and highlights the one you're currently in.
Lists all local branches in the current repository.
git checkout -b <branch_name>Creates a brand new alternative timeline for your code and immediately moves you into it.
Creates a new branch and switches to it.
git switch <branch_name>Moves you out of your current branch and into a different one you specify.
Switches to an existing branch.
git merge <branch_name>Takes all the work from another branch and combines it into the branch you are actively in.
Joins two or more development histories together.
git stashLike putting your messy desk into a drawer temporarily so you can work on something else right now.
Temporarily shelves (or stashes) changes you've made to your working copy.
git restore <file>Throws away any changes you made to a file since your last save.
Restores working tree files.