Thursday, July 9, 2020
Gitting Ahead Hacking Git and GitHub Part 2
Gitting Ahead Hacking Git and GitHub Part 2 Gitting Ahead: Hacking Git and GitHub Part 2 Back Home Categories Online Courses Mock Interviews Webinars NEW Community Write for Us Categories Artificial Intelligence AI vs Machine Learning vs Deep LearningMachine Learning AlgorithmsArtificial Intelligence TutorialWhat is Deep LearningDeep Learning TutorialInstall TensorFlowDeep Learning with PythonBackpropagationTensorFlow TutorialConvolutional Neural Network TutorialVIEW ALL BI and Visualization What is TableauTableau TutorialTableau Interview QuestionsWhat is InformaticaInformatica Interview QuestionsPower BI TutorialPower BI Interview QuestionsOLTP vs OLAPQlikView TutorialAdvanced Excel Formulas TutorialVIEW ALL Big Data What is HadoopHadoop ArchitectureHadoop TutorialHadoop Interview QuestionsHadoop EcosystemData Science vs Big Data vs Data AnalyticsWhat is Big DataMapReduce TutorialPig TutorialSpark TutorialSpark Interview QuestionsBig Data TutorialHive TutorialVIEW ALL Blockchain Blockchain TutorialWhat is BlockchainHyperledger FabricWhat Is EthereumEthereum TutorialB lockchain ApplicationsSolidity TutorialBlockchain ProgrammingHow Blockchain WorksVIEW ALL Cloud Computing What is AWSAWS TutorialAWS CertificationAzure Interview QuestionsAzure TutorialWhat Is Cloud ComputingWhat Is SalesforceIoT TutorialSalesforce TutorialSalesforce Interview QuestionsVIEW ALL Cyber Security Cloud SecurityWhat is CryptographyNmap TutorialSQL Injection AttacksHow To Install Kali LinuxHow to become an Ethical Hacker?Footprinting in Ethical HackingNetwork Scanning for Ethical HackingARP SpoofingApplication SecurityVIEW ALL Data Science Python Pandas TutorialWhat is Machine LearningMachine Learning TutorialMachine Learning ProjectsMachine Learning Interview QuestionsWhat Is Data ScienceSAS TutorialR TutorialData Science ProjectsHow to become a data scientistData Science Interview QuestionsData Scientist SalaryVIEW ALL Data Warehousing and ETL What is Data WarehouseDimension Table in Data WarehousingData Warehousing Interview QuestionsData warehouse architectureTalend T utorialTalend ETL ToolTalend Interview QuestionsFact Table and its TypesInformatica TransformationsInformatica TutorialVIEW ALL Databases What is MySQLMySQL Data TypesSQL JoinsSQL Data TypesWhat is MongoDBMongoDB Interview QuestionsMySQL TutorialSQL Interview QuestionsSQL CommandsMySQL Interview QuestionsVIEW ALL DevOps What is DevOpsDevOps vs AgileDevOps ToolsDevOps TutorialHow To Become A DevOps EngineerDevOps Interview QuestionsWhat Is DockerDocker TutorialDocker Interview QuestionsWhat Is ChefWhat Is KubernetesKubernetes TutorialVIEW ALL Front End Web Development What is JavaScript â" All You Need To Know About JavaScriptJavaScript TutorialJavaScript Interview QuestionsJavaScript FrameworksAngular TutorialAngular Interview QuestionsWhat is REST API?React TutorialReact vs AngularjQuery TutorialNode TutorialReact Interview QuestionsVIEW ALL Mobile Development Android TutorialAndroid Interview QuestionsAndroid ArchitectureAndroid SQLite DatabaseProgramming Gitting Ahead: H... Mast ering Git and GitHub (9 Blogs) Become a Certified Professional Gitting Ahead: Hacking Git and GitHub Part 2 Last updated on May 22,2019 1.2K Views mahtab alam Bookmark Become a Certified Professional This is the second post in the series of Hacking Git and GitHub. In this post, we will drill down into the GitHub markdown for creating README files, adding a .gitignore file, and learn about the most important feature of Git: Branching.Here is a quick recap of the topics we covered in the first post in the series:Downloading and Installing GitCreating a remote repository on GitHubStaging filesCommitting filesPushing changes to remote repositoryIn this post we are going to cover the following topics:Adding README fileWhen to use .gitignore file and how to create oneWhy Git branching and how to use itIt is always a good idea to add a README file to your repository so that other team members can easily identify the contents in their respective repositories. GitHub provides the opt ion of adding a README file when a new repository is created. You can put plain text in the README file or write a GitHub markdown in order to create a beautiful README file with images, lists, tables etc.So what happens if you dont add a README file? Well, you will have to guess what your repository contains. In short, good repositories are always well documented!Lets now add a README file to our LiveProject repositoryHere is a simple README file. We need to make sure it ends with the b.md/b extension.Next, commit the README changes to our remote GitHub repository:This is what your repository will look like, once you push the README file changes to the remote repository.Here is a quick cheat sheet for a GitHub markdown:pre# for H1 header## for H2 header###### for H6 header** This text will be bold *** This text will be italic * or * for unordered list1. 2. 3. for ordered listFor links wrap, link the text in brackets [ ], and provide the link in parentheses ()/preNext, we are going to learn about the .gitignore file, why we need them and how to use them.What is .gitignore file and why we need itWhile developing real world projects, your project will almost certainly include third party libraries as dependencies, or configuration files which might include confidential information. You will definitely not want these files to be available on the remote GitHub repository. To prevent certain files/folders from being pushed to remote GitHub repositories, we use the .gitignore file.Creating a .gitignore fileHere is a snapshot of a Quiz application written in Java. Here, we dont want anything under build and .settings folder to be pushed to the remote GitHub repository. To achieve that, we will mention these both the folder names in our .gitignore file.To create a .gitignore file from the Git shell, you can use the touch command as shown here:We just added two lines for ignoring everything that is under build and .settings folder in our project directory.pre .settings /* build/*/preLets now add and commit the changes, and push it to the GitHub repository:No files under build and .settings folder will be pushed to remote repository, as shown below:Next, we are going to learn more about one of the most important feature of Git: Branching.Why Branching?Problem:Suppose you want to add/update courses.html file to add new features but you dont want to mess the original courses.html file. What will you do?Old School Approach:Most probably you will copy courses.html file and rename it to something else (in this case courses2.html). Once you are satisfied with your changes in courses2.html, you can delete the courses.html file and rename courses2.html to courses.html. This tedious workflow can easily be solved by Git:Git solves this problem very elegantly using its branching feature. So lets now see how to achieve that.Note that Git by default creates master branch when we initialize any directory as Git repository. You can see that usinggit branch comman d as shown below:Next we are going to create a new branch (newFeature) to make the new changes and once we are done with the changes we will merge the newFeature branch to the master branch. This way we can easily try out code experiments without breaking the working code.Creating a new branch :So lets create the newFeature branchEven though we have created the new branch (newFeature), git does not change the working branch automatically on branch creation. To change the working branch to newFeature we usethe git checkout command.For the demo we have just added the h2 header in our courses.html fileLets check the status:As shown above we have modified courses.html on branch newFeature. Lets now add a new fileas we are on newFeature branch.Now we are ready to commit the changes.Note:If we switch to the master branch, you will see that courses.html will be as before and sitemap.html will be absent. As we made the changes in the newFeature branch and not the master branch.Lets now merg e the changes to master branch. To do that, switch to master branch and use the git merge command as shown below:After the merge operation, you will be able to view the changes made in the newFeature branch reflected in the master branch.Thats all there is to know about Gits branching feature. In the next post, we will talk about Git Gists and how to add GitHub Gists to the web pages.Got a question for us? Please mention it in the comments section and we will get back to you.Related Posts:Get Started with Mastering Git and GithubGitting Ahead: Hacking Git and GitHub Part 1Recommended videos for you DevOps-Redefining your IT Strategy Watch Now Ansible Tutorial For Beginners Ansible Playbook Watch Now Continuous Integration With Jenkins Watch Now Puppet Tutorial DevOps Tool For Configuration Management Watch Now 5 Best Practices In DevOps Culture Watch Now Devops : Automate Your Infrastructure With Puppet Watch Now What is DevOps A Beginners Guide To DevOps Watch Now DevOps Tutoria l For Beginners Watch Now What is Git A Complete Git Tutorial For Beginners Watch Now What is Jenkins? Continuous Integration With Jenkins Watch Now What is Docker DevOps Tool For Containerization Watch Now DevOps is Going to Replace SDLC! Learn Why Watch Now Top DevOps Interview Questions And Answers Watch NowRecommended blogs for you Gitting Ahead: Hacking Git and GitHub Part 2 Read Article Top Git Interview Questions You Need To Prepare In 2020 Read Article Ansible Provisioning: Smarter and Effortless way of Provisioning Read Article Ansible Roles- Ultimate way to untangle your Playbooks Read Article What is Jenkins? | Jenkins For Continuous Integration | Edureka Read Article Understanding Kubernetes Architecture Read Article What Is Docker Docker Container ? A Deep Dive Into Docker ! Read Article Jenkins Cheat Sheet A Beginners Guide to Jenkins Read Article Jenkins Git Integration Useful for Every DevOps Professional Read Article Kubernetes vs Docker: Comparing The Two Cont ainer Orchestration Giants! Read Article What is Docker Container? Containerize Your Application Using Docker Read Article Docker Swarm For Achieving High Availability Read Article Top 50 Kubernetes Interview Questions You Must Prepare In 2020 Read Article What are the common Git mistakes and how to fix them? Read Article How to Visualize Kubernetes Cluster Events in real-time Read Article Git Submodules vs. Googleâs Repo Tool Read Article What Is Agile Methodology Know the What and How? Read Article Git Tutorial Commands And Operations In Git Read Article What Is Chef? A Tool Used For Configuration Management Read Article What Are Important Pre-Requisites For DevOps Professionals? Read Article Comments 0 Comments Trending Courses in DevOps DevOps Certification Training72k Enrolled LearnersWeekend/WeekdayLive Class Reviews 5 (28700)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.