- It is a distributed version control repository and it has source code management (SCM) functionality.
- It offers more features like bug tracking, task management, markdown format’s, graphs, email notifications, Gist code snippets and wiki for every project
- It offers both private and public repositories on same account.
- Un-track the specific files/folders by creating a file with “.gitignore”
Git Commands
- git init
- git clone <url>
- git status
- git add <filename> (or) git add .
- git commit –m “<commit message>”
- git remote add <alias> <git-url>
- git remote remove <remote alias name>
- git remote set-url <remote alias name> <new-git-url>
- git push –u <remote –alias-name> <branchname>
- git push –u <remote –alias-name> <branchname>:<newbranch>
- git pull <remote-alias-name> <branchname>
- git pull <remote-alias-name> <branchname> --allow-unrelated-histories
- git checkout –b <new-branch-name>
- git branch
- git checkout <branch-name>
- git branch –d <branch-name>
- git stash
- git checkout -- <file>
- git reset --hard
Regular Branch Create/Push
Steps :
- Go to command prompt (
ex: D:\abc-development> )
- Create branch ( i.e.
abc-task1 ) from “Develop” remote repo
>git checkout -b abc-task1 origin develop
- Make required changes in
abc-task1
- Adding all modifications
to local repo
>git add .
- Commit/stage all modifications
to local repo
> git commit -m “first
commit”
- Push all changes to
remote repo
>git push -u origin
abc-task1
Feature Branch Create/Push
Steps :
- Go to command prompt (
ex: D:\abc-development> )
- Create branch ( i.e.
abc-task1 ) from “feature/abc-task1” remote repo
>git checkout -b abc-task1 origin/feature/abc-task1
- Make required changes in
abc-task1
- Adding all modifications
to local repo
>git add .
- Commit/stage all modifications
to local repo
> git commit -m “first
commit”
- Push all changes to
remote repo
>git push origin
HEAD:feature/abc-task1
Happy Coding :)