Easy git!
Everyone kwows how git is very important for version control and manage project. Everyday thousand of companies and milions of developers uses git to control version and organize their projects. Indeed is undeniable that git is now a part of software development and do not mastering this technology is a big mistake.
However if you do not master basic git's concepts it might put you in a big trouble. Today is your lucky day because in this article I will try to make git easiest as possible and help you try to avoid git being a nightmare.
First of all I am suposing that you already have git installed at your computer. For config please follow below instructions:
git config --list
git config --global user.name examplename
git config --global user.email user@example.com
ssh-keygen -t rsa -b 4096 -C "your_email@example.com
cat ~/.ssh/id_rsa.pub | clip
Well above commands are destinated for people who never used git before and need to config for the first time git at your computer. Ok so far? If you still have any doubts please do not hesitate to check below link:
So once finished all of this basics steps lets keep moving:
Work with git require understands how its workflow works. Basically we have three diferents stages until make sure that one file is at local repository: modified file (Working Directory) , staged file (Stage directory) , commited file (Local Repository). Check image below to understand more about it:

Ok so far? So, I will try to explain more with real example. First of all I'm gonna create a new folder called test and inside it a new javascript file called Test.js and start a git repository.

Inside test.js lets create a factory function about star wars and generate an object from it.

Now lets use basics four success git commands to push our file inside our local repository at master branch
git status
git add .
git commit -m "first commit"
git push origin master

We can use git diff to show us what lines were modifieds at all files modifieds.


git diff allow us to check inside prompt what lines were modified at all files modified. So now let's gonna create a new branch called starwars and use it to commit our new file.

Ok we commited our file inside starwars let's check our github's repository:

As we can see we have two branches and only inside at starwars branch there is our file modified. We can check it by image below

But if I want to send all of modified files at starwars branch to master branch? This is very easy: we need to MERGE branches! =D
For merge please be very advertised that we it only can be submited at destination branch this mean at master branch. And to go back to master branch is very easy: first we are gonna check in what branch we are then we are going to checkout to master branch:
git branch
git checkout branch master
git merge starwars

Ok we are very advanced now. At this point you must be able to already use at least four basics git commands. Let's work a little more. If you want to check the latest commits we just use git log and if we want to see all commit with diffs just use git log -p


Wow! Can you see how far we went? Amazing! So thats all for today. I hope you can be more comfortable to use git. I also recommend always to check official documentation for furthers details and more features.
Thanks! The force will be with you!
