1 / 16

Common Git Commands

Git servers the purpose of tracking changes to files and directories. The functionality of Git can be accessed via the command line.<br>

htshosting
Download Presentation

Common Git Commands

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Common Git Commands Deployment Benefits and Best Practices

  2. Table of Contents • Git • Git Uses • Git’s Functionality • git clone • git add • git commit • git checkout • git rm • git fetch • git pull • git merge • git push

  3. Git • Git refers to a system, which is meant for tracking changes to files as well as directories (a version control system). Git records all the changes in content, and stores the history related to every change. Repositories, which are a type of data structure, are used by Git for managing files. Repositories are present within a specific directory. These contain the files as well as a record with regard to changes. The multiple sets of changes that exist within a repository are separated by branches.

  4. Git Uses • Git is usually used by software developers for managing codes. Git can be used by anyone for managing any type of file. The flexibility of Git enables the use of Git for both, simple as well as complex projects. Git-managed content can be configured as per one’s needs. This is made possible through multiple branches and repositories. There are certain features in Git, which enable the viewing of information with regard to revisions, as well as aid in finding the cause of an issue, and manipulate changes.

  5. Git’s Functionality • The command line is used to access all of Git’s functionality. Some of its most common commands and options are listed in the following slides. • The information contained here isn’t comprehensive, and information about intermediate as well as advanced Git functionality have been omitted.

  6. 1-800-123 -8156 Whoa! That’s a big number, aren’t you proud?

  7. Git Clone It is a command that is meant for cloning a repository into a new directory. It also creates remote-tracking branches, as well as forks a new working branch from the active branch of the cloned repository. • The git fetch command should be used to update the remote-tracking branches of the new repository. • The git pull command should be used for merging the remote master branch into the current master branch. • The Git Version Control interface in cPanel provides the URL, which is used for cloning the repositories of each account. cPanel >> Home >> Files >> Git Version Control

  8. Git Add • This command is used for adding a file’s current version to the index of staged content for the next commit. • Only the current changes for the current commit are staged by this command. When a commit is created again, the command for the file needs to be run again. This is needed to stage any new changes.

  9. Git Commit • This command is meant for creating a new commit for the currently-staged changes. • Use the git add or the git rm commands for staging changes for inclusion in a commit, or individual filepaths can be provided as arguments to this command.

  10. Git Checkout • Through this command a specified branch can be set as the current working branch. • This command needs to be run with a file path, rather than a branch name, for the purpose of checking out only a specified file. • If the branch name is omitted, Git will check out that file from the current branch’s HEAD.

  11. Git RM • This command serves the function of removing directories or files from Git’s index, and working tree. • The specified file should not contain uncommitted changes, if this command needs to be run. • This command isn’t capable of retaining the file in the index, and removing it from the working tree. To get that done, you have to use BASH’s rm command.

  12. Git Fetch • Branches, tags, as well as their histories are downloaded by this command from one or more repositories.

  13. Git Pull • This command is used for fetching and merging changes from a local branch or from a remote or local repository. Usually, this command combines the git fetch and the git merge commands.

  14. Git Merge • This command is meant for combining the history of one or multiple commits into the current branch’s history.

  15. Git Push • This command is used to add the committed changes to that repository and branch, which have been specified. A repository needs to be explicitly specified, in order to specify a branch. If a branch isn’t specified, the command adds the changes to the current branch of the remote repository. • The Git Version Control feature in cPanel automatically adds a post-receive hook. This is triggered by each push to cPanel-manged repositories. • To digress, cPanel is a web hosting control panel. Web hosting is a service provided by web hosting companies for making websites accessible. Web hosting can be of many types. For example, terms such as “Linux Shared Hosting”, and “Windows Shared Hosting”, refer to a type of web hosting that is shared and Linux-based.

  16. Thanks! ANY QUESTIONS? www.htshosting.org www.htshosting.org/best-web-hosting-company-India www.htshosting.org/best-windows-hosting www.htshosting.org/best-cloud-hosting-company

More Related