My Git Learnings | part 1
Today I faced a problem in my project branch and it took some time to solve that because I knew only few common git commands. While searching a solution on google I understood that we can go deep in to git. So that fault force me to learn more about git. Now I am going to share my new git knowledge with you, Let’s start….
What is git
Git is a distributed version-control system for tracking changes in any set of files [Source : Wikipedia]
Git work flow
Git project
Have you ever visited in to your .git folder in your project. I think most of you say no :) .Let’s see folder structure on that.
In here I’m not going to explain what happen in this .git folder. But It is very interesting thing to know how git manage it’s folders. We will discuss that on another article.
Basic git commands
$ git init
- nitialised empty git repository in <directory>
- The beginning of everything
- create .git directory in file systemgit
clone <SSH or HTTP path>
- Clone git repository for your local environment
git branch <branch-name>
- Create a new branch
git checkout <branch-name>
- Switch to a different branch
git add <filename>git add *
- Add file / files
git commit -m “Commit message”
- Commit changes to head
git commit -a
- git add And git commit without commit message
git pull origin <remote branch name>
- Sync with new changes on remote branch
git push
- Push changes to your remote repository