My first Pull, Commit, and Push with Git!

My first Pull, Commit, and Push with Git!

“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.”

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.

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.

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.

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.

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”.


Discover more from Coursity

Subscribe to get the latest posts to your email.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *