Friday, 8 September 2017

GIT - getting started

Git is a version control system (VCS) for code. It is used to keep track of revisions and allow a development team to work together on a project through branches. This fast guide has the scope of show an overview of git using the command line interface (CLI). 

To begin with a clone a remote repository in your directory:
$ git clone http://<username>@<repository_url>
From your directory you can switch branch with:
$ git checkout <branch_name>
If you want create a new local branch:
$ git checkout -b <branch_name>
To show the current branch:
$ git branch
The command shows the branch list and the current branch is that with *. For the status about the files changed
$ git status
When a file has some changes, you can revert your changes with:
$ git checkout -- <file_with_changes>
or you can add it to commit file list:
$ git add <file_with_changes>
now you can commit the file in your local repository:
$ git commit -m "your comment"
To update the local repository with the remote repository:
$ git pull
For merge from a branch with the current branch:
$ git merge <branch_target>
To update the branch on remote repository
$ git push origin <your_branch>
To create a local tag
$ git tag <tag_name>
To add a local tag in remote repository
$ git push origin <tag_name>

No comments:

Post a Comment

Welcome

Hello everybody, Welcome in my blog called "Information technology archive". Obviously the topics will be related to Informatio...