- Published on
New Git Repo
Learn GIT concepts and vocabulary via code you've seen often
Note: this page depends heavily on tooltips in order to remain concise. Click the tooltips for any term that you want to learn more about. Note: the tooltips show much more detail on devices with screens wider than 450 pixels. ...more
Git vocabulary is important for communicating with team members, for understanding messages from the tool itself, and for searching Google for Git solutions. Let's see what can be learned by looking at a simple Git example for initializing a GitHub repository. The below code will:- initialize a git repository
- make the first commit
- push the changes to GitHub
Note: the below code is suggested by GitHub when you create a new empty repo.
$ echo "# repo-name" >> README.md
$ git init
$ git add README.md
$ git commit -m "first commit"
$ git branch -M main # rename default branch to 'main'
$ git remote add origin https://GitHub.com/userid/repo-name.git
$ git push -u origin main
$ git init
$ git add README.md
$ git commit -m "first commit"
$ git branch -M main # rename default branch to 'main'
$ git remote add origin https://GitHub.com/userid/repo-name.git
$ git push -u origin main
Diagram - how code changes move through the Git system
Find out about your file changes move from your working directory to the staging area, the local repository, then the remote repository. Mouseover the diagram objects for more information. (mouseover unavailable on some mobile devices)
Related:
- Git cheat sheets: beginner, intermediate, expert
- How to Teach Git
- What Is An Initial Commit In Git?