Common Git commands and must know things about Git Flashcards

- Learn all the common Git commands - Learn practical blocks of Git Commands - Miscellaneous about Git and GitHub

1
Q

How do you add a new project to GitHub for the first time? (Hint: There are 5 commands in total )

A

A.) (Create the Repository on GitHub.com using the GUI tools. Recommended.)

1.) Initialize the local directory as a Git repository:
$ git init -b main

2.) Add the files in your new local repository. This stages them for the first commit:
$ git add .

3.) Commit the files that you’ve staged in your local repository:
$ git commit -m “FirstCommit”

4.) add the URL for the remote repository where your local repository will be pushed.
$ git remote add origin https://github.com/your/repository
$ git remote set-url origin https://github.com/your/repository

5.) Push the changes in your local repository to GitHub:
$ git push origin master

How well did you know this?
1
Not at all
2
3
4
5
Perfectly