New version page

GIT

Upgrade to remove ads
Upgrade to remove ads
Unformatted text preview:

Devops =Development(Dev/QA) + operations(Admin/Networking/DBA)Development team tasks1. Coding/designing/testingOperations team tasksManage the servers/services on the serversManage the networks/Logging/Monitoring i.e Infra is managed by OPS teamContinuous DevelopmentContinuous testingContinuous integrationContinuous Deployment: when there is a change is made, it will automatically hit the productionContinuous delivery: safe method, it will be deployed to production after manual approval means we can decide which release is going to production which change is going to production.Continuous MonitoringAws instance lauch->.pem file generatePutty key generator ->upload that pem file and generate ppk filePutty ->upload that ppk file and start the sessionIn any version control system developers can work parallel on the same file in the same project, if without the VCS, last commit would overwrite the changes done by the former developer, VCS does notallow it and prevents it by giving a warning as conflict and ask which changes needs to be merged.2. If you have any production issue occurred in some build then through vcs you can up the last successful release and debug the current issue.3. Can check the logs . the revision . changes done by other developer.Local version controlCentralized version control : like svn but the pblem is as all the files are checked in central server and that is only point to maintain all the files, if that goes down then all files lostAnd second is the network connection, one has to remain online to connect to itDistributed version controlEvery developer has a copy of the remote depository at its local which is as local repository1. GITa. Branching and mergingb. Small and fast and distributedStaging area is a layer between working directory and local repository where your code can be reviewed before committing to local repository.Git flow :Initially we add the code from working directory to your staging area and then commit the code from staging to local repository which is then pushed to remote repository.1. Git init2. Git ls-files : will show file if any in local repository3. Git add filename4. Git commit –m “” filename->but before committing any changes it will ask for username and email which is set usingGit config –global user.name “abc”Git config –global user.email [email protected] If you modify the existing file then you don’t need to add that file to the staging area you can directly commit that file usingGit commit –a –m “newfilechanges” 6. To check the history of commits done so far use git log –oneline or to check the logs of a particular file use git log filename7. To check the changes in a file which is not added to the staging area we can use git diff filename8. To remove the file from both the local and working repository use git rm filename and then committing the changes.9. If you want to remove the file only from local repository use git rm –cached and then use git commit which will now consider your file only in staging area.10. If you want that your file should not be versioned control in your git project then you can add that file in .gitignore and then commit that file,when doing git status git will not consider that file even if it is not added.11. If you want to remove the changes in any file in the working directory which has not yet been staged you can use git checkout -- filename12. If you want to reset the changes once you have added the file in the staging area then useGit reset head filename -> after doing this it will again ask you to add it in staging area. Branching in GITThe default branch in GIT is master branch where you basically check in your code when you start a project. But when there is new feature to be implemented we don’t do the changes directly in master branch but we create a copy from master branch and create a new branch out of it which will be the copy of master branch plus the new features implemented. Once the changes are done inthe new branch and validated we will merge those changes in the master branch and resolve conflicts if any.So to list all the branch we use git branch and will populate master branch out of it.To create a new branch use git checkout –b test(branchname)When new branch is created do the respective changes and commit those changes.Now the changes are in the new branch and we need to merge those changes in the master branch.So we need to switch to master branch and then perform the merge using git merge <newbranch>Git stashing:It happens some times that we are working on some files and we come across some other production issue in some other file but we can’t commit the previous files as the work is not completed. So we stash those files and move them to a temp shelf and can unstash them once that production issue work is completed and can work on existing files.Do git stash to stash the files and git stash list to check the no of files stashed.Git show <stashno>Git stash pop <stashno> : we can unstash the stashed files and get back to them in working directory.Git pushNow it’s the time to push your changes to remote repository so use the following command:First add your project to remote repository:Git remote add origin <project url> and thenGit push origin masterIt will pop up for username and password every time you do git push.. so to avoid it use:Git config credential.helper storeGit push <url>And enter username and password, it wont again ask you for username and password.Let’s say you have joined the team and project is aleady created on remote repository then you have to clone the projectGit clone <.git>Once you have cloned the project and there is any change in the remote repository then you can pull the changes using the command git pull origin masterDiff between git fetch and git pull is that git fetch only displays the changes of remote repository butdo not merge it but git pull is git fetch + git merge.Similarly git clone and git pull, git clone is done for the first time and then after that git pull is done.Suppose you have the same file in remote repository and the same file in your local repository , aftersome changes when we do git push it will not allow you to push because of the diff in the changes inboth the files so better pull the changes before, resolve conflicts and then push those changes.Git branch –merged masterTagging in GITTagging is basically freezing the branch and creating a release out of it , we can also


View Full Document
Download GIT
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view GIT and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view GIT 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?