How to - git add, commit & push
Ok, you have created or previously cloned a repository, have now changed something and want to "upload" it. We call this pushing!
Let's take a look at an example
I have just created a Git clone tutorial and now want to upload it to our repository.


-
open the GitBash (Windows) or the terminal (Mac).
-
with
cdI navigate to the folder of the repository. (Green)e.g.:
cd Git_Stuff\guides
Git_Stuff\guides*is the name of the path. Your path is probably different! -
with
git statusI query the current status. (Blue) I see that I have "Untracked files " and it even suggests adding them withgit add. -
i add the file
HowToGitClone.mdwithgit add. (Yellow) Then I query the status again, but this is not necessary but only for demonstration purposes!-
The
HowToGitClone.mdis displayed under "Changes to be committed ". -
Next, I add the folder
Screenshots-GitClonewithgit add. -
I then query the status again and see that all files have now been added.
-
-
git commit -m "..."(Red)-
Each commit is provided with a message. Especially when several people are working together, it can be useful to briefly describe what has been changed. In my case, I have added instructions for cloning repositories.
-
The
-mstands for message, by the way. -
I then ran
git stausagain for demonstration purposes. We can now see that all local changes have been added to the local repository and provided with a message.
-
-
git pushnow ensures that our changes are uploaded. (gray)