IT4200 - The devops lifecycle

Source code Management

What is Source Code Management?

  • Source Code: Human-readable code written in high-level languages.
  • Binaries: Compiled, executable versions of source code.
  • SCM Tool: Manages source code, tracks changes, and facilitates collaboration.

Why Use SCM?

  • Collaboration: Multiple developers can work on the same codebase.
  • Security: Store code securely in a central location.
  • Versioning: Track changes, roll back if needed.
  • History: Maintain a record of who made what changes.
  • Reviews: Facilitate peer reviews of code.

Benefits of SCM

  • Improved Collaboration: Multiple developers can work together seamlessly.
  • Efficient Workflows: Streamlined development processes.
  • Version Control: Manage changes effectively.
  • Repository Management: Centralized code storage.
  • Branching and Merging: Work on features independently.
  • Change Tracking and Auditing: Monitor and review changes.
  • Enhanced Quality and Maintainability: Better software management.

Popular SCM Tools

  • Git: The most popular and de facto standard.
  • Subversion (SVN): Centralized version control system.
  • Mercurial: Distributed version control system.
  • CVS: Concurrent Versions System, an older tool.

But I'm not a coder. Why do I care?

  • Infrastructure as code (Terraform, CloudFormation templates)
  • Docker files
  • Other configs

A Crash Course on Git

Introduction to Git

  • Distributed Version Control System: Every repository is a complete copy.
  • Local and Remote Repositories: Changes are synchronized between them.
  • Popularity: Most widely used SCM tool.

Basic Git Workflow

  1. Install Git: Set up Git on your local machine.
  2. Initialize Repository: Create a new local Git repository.
  3. Make Changes: Add and edit files in the repository.
  4. Commit Changes: Save changes to the local repository.
  5. Push Changes: Synchronize local changes with a remote repository.
  6. Pull Changes: Update local repository with changes from the remote repository.

Creation

  • Navigate to github and create a repo.
  • https or ssh?
    • Make sure you can do ssh, add and create a keypair
    • ssh-keygen -t rsa

Commands

  • git status
  • git add filename.txt
  • git commit -m "First commit"
  • git log
  • git diff
  • git status
  • git push
  • git pull

Merge conflicts

What if you edited something on the remote side (or another user did) and you try to run a git push and something is overwritten? Try it.