Skip to content

Apprentice

Sophisticated Technology for a Contributor

Introduction to Material for MKDocs

  • Website: Material for MKDocs
  • Start Learning: Reference Material for MKDoc
  • Login Information:
    • Username: none required
    • Password: none required
  • Description: Write your documentation in Markdown and create a professional static site in minutes – searchable, customizable, in 60+ languages, for all devices.

GitLab

  • Website: GitLab
  • Start Learning: GitLab Learn
  • Login Information:
    • Username: register with email to create unique handle
    • Password: you'll create it when you sign in
  • Description: GitLab is a web-based Git repository that provides free open and private repositories, issue-following capabilities, and wikis. It is a complete DevOps platform that enables professionals to perform all the tasks in a project—from project planning and source code management to monitoring and security

Introduction to Git

What is Git?

Git is a distributed version control system (DVCS) that tracks changes to files and coordinates work on those files among multiple people. It's widely used in software development and is essential for collaborating on projects with others.

Key Git Terms and Definitions:

  1. Repository (Repo): A collection of files and folders that you want to track changes to. It also includes the entire history of changes.
  2. Commit: A set of changes to files. It's like a snapshot of the files at a certain point in time.
  3. Branch: A separate line of development. By default, the main branch is called "master" or "main".
  4. Clone: Creating a copy of a repository.
  5. Fork: A personal copy of someone else's repository. Useful for proposing changes to someone else's project.
  6. Pull: Fetching changes from a remote repository.
  7. Push: Sending your commits to a remote repository.
  8. Pull Request (PR): Proposing your changes to the owner of the repository. The owner can then "merge" your changes.
  9. Merge: Applying changes from one branch to another.
  10. Remote: A version of your repository hosted on the internet (e.g., on platforms like GitHub or Bitbucket).

Basic Git Commands:

  • Initializing a repository: git init
  • Cloning a repository: git clone [URL]
  • Checking the status of your changes: git status
  • Adding changes to be committed:
    • Add all changes: git add .
    • Add specific file: git add [filename]
  • Committing your changes: git commit -m "Your commit message here"
  • Pushing your changes to a remote repository: git push [remote-name] [branch-name]
  • Pulling changes from a remote repository: git pull [remote-name] [branch-name]
  • Creating a new branch: git branch [branch-name]
  • Switching to a different branch: git checkout [branch-name]
  • Merging one branch into another: git merge [source-branch] [target-branch]

Example Workflow:

  1. Initialize a new repository:
    git init
  2. Make changes to your files. Let's assume you edited example.txt.
  3. Check your changes: git status

    This will show you the files that have been modified and are ready to be committed.

  4. Add the changes to be committed: git add example.txt

  5. Commit the changes: git commit -m "Edited example.txt for clarity"
  6. If you're working with a remote repository (like on GitHub), you'd then push your changes to share them with others: git push origin master
  7. If someone else made changes and you want to get those, you'd pull those changes: git pull origin master

Remember, Git can be complex, but with practice, you'll get the hang of it. Platforms like GitLab also offer graphical interfaces and guides that can simplify many of the processes. Whenever in doubt, always check the Git documentation or seek help from the community.