Using Git requires getting familiar with its commands and their usage. The list below contains some of the more important commands:
- init – Used for creating and initializing repository (project). Most often it is done on a server where the entire repository is stored.
- clone – Download repository.
- add – Add files to git repository.
- commit – Add changes to current branch.
- rm – Delete files from repository.
- branch – Create a branch.
- checkout – Change current branch.
- merge – Merge two branches.
- pull – Download changes from remote git repository and merge it with local download.
- push – Upload changes to repository.
The use of the Git commands and their sequence depends on the action we want to perform. Below you can see an example for some of the most common actions that can be performed after downloading a Git project:
Add files to project:
- Copy files to downloaded repository folder.
- Add files using command add.
- Use commit to add changes.
- Use command push to upload changes to remote repository.
Change content of added files:
- Make your changes.
- Use commit to add changes.
- Use command push to upload changes to remote repository.
Delete files:
- Use command rm to remove files.
- Use commit to add changes.
- Use command push to upload changes to remote repository.
Was this article helpful?
If you have any suggestions or questions, please leave a comment below.
Leave A Comment