1 / 18

GIT Commands

Git is one of the best version control tools available in the present market. This emerging star was first developed by Linus Torvalds, the creator of the Linux kernel. There is no singular centralized code base that the code can be pulled from, and different branches are responsible for hosting different areas of the code.<br>Git is fast and efficient and is used by system administrators and open-source projects to power their repositories.Read the document to read in detail aboit GIT,its commands, installing GIT in Windows and installing GIT on AWS.<br>

Devops3
Télécharger la présentation

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. Git Tutorials – GitCommands Git • What isGit? • GIT is an open source Distributed Version Control System (DVCS) which records changes made in your project or a set of files laying emphasis on speed, data integrity and distributed, non-linearworkflows. • Git isoneofthebestversioncontroltoolsavailableinthepresentmarket.This emerging star was first developed by Linus Torvalds, the creator of the Linux kernel. There is no singular centralized code base that the code can be pulled from, and different branches are responsible for hosting different areas of the code. • Git is fast and efficient and is used by system administrators and open-source projects to power theirrepositories. • Goals ofGit: • Speed • Support for non-lineardevelopment • Fullydistributed • Able to handle large projectsefficiently • Each update in the code is recorded in Git’s history, which is stored in adata • structure called a Git repository. This repository is the core ofGit. • WhyGit? • Feature branchworkflow

  2. Each branch function in an isolated environment while updates are made inthe codebase. This way, its ensured that the master branch always has the production-qualitycode PullRequests • A developer calls a pull request to ask another developer to merge oneof • his/her branches into the other’s coderepository • Makes it easy for project leaders to monitor and track codechanges • Community • Very popular, widely used, and accepted as standard version control systemby • the vast majority within the developer’scommunity. • Large number of Git users make it easy to resolve issues and seek outsidehelp using onlineforums. • GitBasics • FileStates • There are three main states that your Git files can residein: • In your local repo(Committed) • HEAD – last commit snapshot, nextparent • Checked-out and modified but not yet committed (workingdirectory) • Sandbox – contents unpacked into actualfiles • Or, in-between, in a “staging”area • Staged files are ready to becommitted • A commit saves a snapshot of the current state of stagingarea

  3. Index – proposed next commitsnapshot • The remote repository (git directory) is the server where all the collaborators uploadchangesmadetothefile,itiswheretheworkfromalldevelopersgets integrated. • Basic GitWorkflow • Modify the files in your workingdirectory. • Move the files to the staging area by staging them – adding snapshots of them to your stagingarea. • Commit, which takes the files in the staging area and stores that snapshot permanently to your Gitdirectory. • Git generates a unique ID which is a 40 character string of hex digits for each commit and refers to the commits by this ID rather than the versionnumber

  4. Branching &Merging • A branch in Git is lightweight and the pointer always points to one of the commits. • The default branch name in Git is“master”. • Each time a commit is made, the master branch pointer movesforward automatically. • Features OfGit • Free and opensource: • Git is released under GPL (General Public License) open source license. You don’t need to purchase Git. It is absolutely free. As its open source, the source code can be modified as perrequirements. • Speed: • Since there is no dependency on a network connection, the performance is really fast for all operations. Performance tests done by Mozilla haveproved that its way faster than other version control systems. Fetching version history from a locally stored repository is much faster than fetching it from the remoteserver.

  5. Scalable: • Git is quite scalable. Git can easily handle if the number ofcollaborators • increase. The data stored on the client’s side is very small as Gitcompresses • the huge data through a lossless compressiontechnique. • Reliable: • Since every contributor has a local repository, if the system crashes, thelost • data can be recovered from any of the local repository. There is always a backup of all files. The Git history is stored in a way that the version ID ofa particular version (a commit in Git terms) depends upon the complete development history leading up to thatcommit. • Non-linear: • Git includes specific tools for visualizing and navigating anon-linear • development history and supports rapid branching and merging. A change will be merged more often that it is written, when its passed around various reviewers, is what Git assumes. Branches in Git are very lightweight. A branch in Git is just a reference to a particular commit. With the knowledge aboutthe parental commits, the full branch structure can beconstructed. • Branching: • Branching is a very powerful feature of git. Branch management with Git is very simple. It takes just a few seconds to create, delete or merge branches. For every change to the codebase, feature branches provide an isolated environment. Whenever a developer wants to work on something, nomatter what the size, he will always create a new branch. So, this way it is ensured that the master branch always contains production-qualitycode. • Distributed: • Git provides each developer a local copy of the completedevelopment • history, and changes are copied from one such repository to another.These changes are imported as additional development branches, and can be merged in the same manner as a localbranch. • Greatercollaboration: • A major benefit of the Git workflow is increased collaboration. Githelps • teamstotalktoeachotherearly andmorefrequently, enablingthemtoshare • feedback and integrate suggestions. The ease with which the Git repositories can be accessed, makes it simple for the users across the organization to collaborate and spot errors quickly, resulting in better and more stablecode.

  6. Git: A Giant Leap TowardDevOps • DevOps is about completely removing process bottlenecks, quicker feedback, shortening development cycle and improving overall softwarelifecycle. • A sensible way to start on the DevOps path is to learn how to use a version control system such as Git. Git is an integral part ofDevOps. • Git plays an important role in managing the code that the collaborators commit to the shared repository. This code is then extracted to perform continuous integration, to create a build and test it on the test server and finally deploy it on theproduction. • Git enables communication between the development and operationsteam, • commit messages play a vital role in information exchange. The deployable bits and pieces all lie in the Version Control system likeGit. • Git alone might not be able toovercome the barriers between Dev and Ops but it surely provides some remarkable capabilities that make a big difference to the IT organizations, giving substantial benefits, like: • They are about twice as likely to exceed profitability, market share and productivitygoals. • Their employees reported far higher levels of jobsatisfaction. • They realize 50 percent higher market capitalization growth over a three-year period. • Git provides both the capabilities that characterize high performing IT organizations: version control of production artifacts and peer review of updates. • Let us now look at the GitCommands. Workshop on Certified DevOpsFoundation  $99USD

  7. Workshop on Certified DevOpsProfessional  $295USD Get DevOpsCertified  BuyCertifications GitCommands

  8. Workshop on Certified DevOpsFoundation  $99USD

  9. Workshop on Certified DevOpsProfessional  $295USD Get DevOpsCertified  BuyCertifications Installing Git onWindows Step 1: Go to https://www.git-scm.com/. Click on Download [latest version] for Windows. Step 2: You will view the below screen. Download has started and the .exe file isdownloading.

  10. Step 3: Click on Next when this popup windowopens. Step 4: Check the below options and clickNext.

  11. Step 5: The below screen comes. ClickNext. Step 6: Choose the appropriate option and clickNext.

  12. Step 7: Choose the library option and click onNext. Step 8: Choose the checkout option and clickNext.

  13. Step 9: Choose the emulator and clickNext. Step 10: Choose configuration options and click onInstall.

  14. Step 11: Once the installation completes, the Git GUIopens. After installing Git in your Windows system, just open your folder/directory where you want to store all your project files; right click and select ‘GitBash here’.

  15. We will run the commands on Windows and operations using Git Bash. GitBash is a text-only command line interface for using Git on Windows which provides features to run automatedscripts. Now, let us open Git Bash and run someGit commands 1. $ git init“[repository-name]” To view the git folder, you use the command ls -la as it is a hiddenfolder. 2. $ gitconfig

  16. 3. $ git add . or git add[filename] 4. $ gitcommit 5. gitstatus 6. git checkout -b[branchname] 7. gitlog

  17. 8. git ls-files–stage 9. gitdiff 10. gitmerge

More Related