My first Pull, Commit, and Push with Git!

Manish Goyal - Jun 6 - - Dev Community

"Little things can have a big impact on our daily life. Playing with Git is very exciting. As a beginner, solving minor issues provides great motivation. This is how I push code into GitHub."

  • Run
git init
Enter fullscreen mode Exit fullscreen mode

in the terminal. This will initialize the folder/repository that you have on your local computer system.
Run git add . in the terminal. This will track any changes made to the folder on your system, since the last commit. As this is the first time you are committing the contents of the folder, it will add everything.

  • Run
git commit -m
Enter fullscreen mode Exit fullscreen mode

"insert Message here". This will prepare the added/tracked changes to the folder on your system for pushing to Github. Here, insert Message here can be replaced with any relevant commit message of your choice.

  • Run
git remote add origin https://github.com/manishwin/tic-tac-toe.git
Enter fullscreen mode Exit fullscreen mode

in the terminal. Here, manishwin and tic-tac-toe will be replaced by the values provided in the copied link. This will push the existing folder on you local computer system, to the newly created Github repository.

  • Run
git remote -v
Enter fullscreen mode Exit fullscreen mode

. This does some git pull and git push magic, to ensure that the contents of your new Github repository, and the folder on you local system are the same.

  • Run
git push origin master
Enter fullscreen mode Exit fullscreen mode

. Note that the last word in the command master, is not a fixed entry when running git push. It can be replaced with any relevant “branch_name”.

.