Create a new repository
Navigate in the directory where you want to init a new local git repo:
Adding a remote repo
To push you change on a remote server you have to add the origin:
git remote add origin <link to your repo>
Work with files | Staging
Whenever you create new file or modify existing one you have to stage, commit and push; i’ll show the way i use it (but there are more)
git add .
This command stage all the new/modified file in the working folder Your can add only certain file specifing the file name
git add <filename>
Now we have staged file ready to be committed, you can prepare the commit with the commnad
git commit -m "useful message"
Is good practice writing useful commit message for tracking and rollbacking purpose
The modifies are now ready to be push, so let’s push them on the remote
Branching is a very useful practice when you use a version-control system, i’ll leave you a more detailed description on how it works here, in this artcle i will only show you the basic command to efficently manage this feature.
Create a branch
Move in your working directory and type the command:
git checkout -b <branch name>
This instruction tell git to create a branch named
Enter a branch that alredy exists
To work in a pre-existing branch you can use:
git checkout <branch name>
For this post is all, maybe i will do a 102 post later this year.