Git Commands

Developed with
Atlassian
play-arrow
Start course
Overview
DifficultyBeginner
Duration2h 8m
Students116
Ratings
4/5
star star star star star-border

Description

Take this beginner level course on 'Atlassian BitBucket' to delve into the core principles and applied benefits for your software projects. This course made up of 8 lectures and 14 demos, will expertly teach and explain how to perform Git related tasks along with implementing and connecting BitBucket to third parties while always being aware of the various security options available.

This course would appeal to a range of job roles, including, Software Developers, Build and Release Engineers and DevOps Practitioners. All of the skills that you will gain from doing this Course will yield a tangible dividend for the projects with your enterprise; allowing you to use, control and manage BitBucket to manage and maintain your software products.

Learning Objectives 

  • Understand the basic principles of version control as implemented using the Git protocol and
  • Learn how to effectively use BitBucket to manage and maintain your software projects
  • Assess the benefits of using BitBucket to manage and secure your software engineering assets
  • Recognize and explain how to perform all basic Git related tasks such as creating and cloning a repository, branching, and merging.
  • Study to implement and connect BitBucket with other 3rd party systems 
  • Be aware of the different security options available to secure your BitBucket setup
  • Be able to use, control, and manage BitBucket through either using the web-based administration console and/or by using a git client.

Intended Audience

  • Software Developers 
  • Software Build and Release Engineers
  • DevOps Practitioners

Prerequisites

To be able to get the most out of this course we recommend having a basic understanding of:

  • Software development and the software development life cycle
  • Software development tools
  • Version control and associated workflows

Related Training Content

After completing this course we recommend taking the 'Introduction to Continuous Integration' Course

To discover more content like this, you will find all of our training in the Cloud Academy Content Training Library.

Transcript

Welcome back. In this lecture, we'll provide you with a quick fire introduction to common Git commands and some text. This lecture and the previous one, are intended to bring those who are unfamiliar with Git, up to speed before we deep dive back into Bitbucket itself. If you're already familiar with Git, feel free to skip straight ahead to the Bitbucket lectures. Okay, let's begin. The following Git commands are used to initialize and configure Git. Typically only performed once, after installation of Git. git config --global user.name "[your name]" configures your username to be attached to your commits. git config --global user.email "[your email address]" configures your email address to be attached to your commits. The following Git commands are used to initialize, create and clone Git repositories. git init [name] initializes a new local repository with the specified repository name. git clone [url] clones a remote repository locally including its entire history. The following Git commands are used to manage coding changes locally. git status provides a list of all modified, tracked and untracked files in the current workspace. git difference lists all file difference not yet staged. git add [file] stages the modified file from the workspace, adding it to the index in preparation for the next commit. git reset [file] unstages the modified file, preserving its modifications back within the workspace. git diff --commit lists all file differences between staging and the HEAD version. git commit -m "[commit message]" commits all staged files permanently into the commit history of the local repository. 

The following Git commands are used to perform branching and merging. git branch displays all existing branches in the local repository, with the current branch highlighted with an asterisk. git branch [name] creates a new named branch. git checkout [name] checks out named branch and replaces the local workspace contents with contents from branch. git merge [name] merges the named branch's history into the current branch. git branch -d [name] deletes the named branch, typically done after merging. The following Git commands are used to refactor and reorganize files. git rm [filename] deletes the file from the local workspace and stages the deletion of the file form the local repo. git mc [filename-orig] [filename-new] moves the file within the local workspace and stages the same move to be made in the local repository. The following Git commands are used to analyze and review commit history. git log displays the commit log history for the local repository. git log --follow [file] displays the commit history for the named file. git log --graph --oneline --decorate --all displays the branching structure history for the local repository. git diff [branch 1] ... [branch 2] displays all file content differences between the two names branches. git show [commit] displays commit specific metadata and content changes. 

The following Git commands are used to sync changes between the local and remote repositories. git pull downloads changes from a remote repository into the local current branch. git push unloads all local repository commits to the remote repository. git merge: in it's simplest form, merges from the local repository into the current workspace, combining development histories together. git fetch [branch] retrieves all named branch history from the remote repository into the local repository, but does not merge into the current local workspace. The following Git commands are used to change commit history. git reset [commit] rewinds all commits after the given commit ID, preserving changed within the local workspace. git reset --hard [commit]: both the staging and workspace are reset to match that of the provided commit. The following Git commands are used to perform code stashing. git stash temporarily stash local workspace modified files and replace with current branch version. git stash pop restores the most recently stashed files. git stash list displays all currently stashed changesets. git stash drop deletes the most recently stashed changeset. Okay, that completes this quick fire introduction to the more commonly used Git commands. Go ahead and close this lecture and we'll see you shortly in the next one.

About the Author

Students10107
Labs26
Courses61
Learning paths14

Jeremy is the DevOps Content Lead at Cloud Academy where he specializes in developing technical training documentation for DevOps.

He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 20+ years. In recent times, Jeremy has been focused on DevOps, Cloud, Security, and Machine Learning.

Jeremy holds professional certifications for both the AWS and GCP cloud platforms.
 

Covered Topics