BASIC GIT WORKFLOW
Create a "repository" (project) with a git hosting tool (like Bitbucket)
Copy (or clone) the repository to your local machine
Add a file to your local repo and "commit" (save) the changes
"Push" your changes to your master branch
Create a "repository" (project) with a git hosting tool (like Bitbucket)
Copy (or clone) the repository to your local machine
Add a file to your local repo and "commit" (save) the changes
"Push" your changes to your master branch

Make a change to your file with a git hosting tool and commit
"Pull" the changes to your local machine
Create a "branch" (version), make a change, commit the change
Open a "pull request" (propose changes to the master branch)
"Merge" your branch to the master branch.
"Pull" the changes to your local machine
Create a "branch" (version), make a change, commit the change
Open a "pull request" (propose changes to the master branch)
"Merge" your branch to the master branch.

WHAT IS VERSION CONTROL
Version control, also known as source control, is the practice of tracking and managing changes to software code. Version control systems are software tools that help software teams manage changes to source code over time.
Helps in tracking all changes.
Version control, also known as source control, is the practice of tracking and managing changes to software code. Version control systems are software tools that help software teams manage changes to source code over time.
Helps in tracking all changes.
GIT INIT
The git init command creates a new Git repository. It can be used to convert an existing, unversioned project to a Git repository or initialize a new, empty repository. This is usually the first command you'll run in a new project.
The git init command creates a new Git repository. It can be used to convert an existing, unversioned project to a Git repository or initialize a new, empty repository. This is usually the first command you'll run in a new project.

Executing git init creates a .git subdirectory in the current working directory, which contains all of the necessary Git metadata for the new repository. This metadata includes subdirectories for objects, refs, and template files.

USAGE
// git init
Transform the current directory into a Git repo & adds a .git subdirectory to the current directory and makes it possible to start recording revisions of the project.
// git init <directory>
Creates an empty Git repository in the specified directory.
// git init
Transform the current directory into a Git repo & adds a .git subdirectory to the current directory and makes it possible to start recording revisions of the project.
// git init <directory>
Creates an empty Git repository in the specified directory.

git init vs. git clone
git clone is used to create a copy of an existing repository. Internally, git clone first calls git init to create a new repository. It then copies the data from the existing repository, and checks out a new set of working files.
git clone is used to create a copy of an existing repository. Internally, git clone first calls git init to create a new repository. It then copies the data from the existing repository, and checks out a new set of working files.

Bare repositories
// git init --bare <directory>
N/B: the bare version of a repository called my-project should be stored in a directory called my-project.git.
The --bare flag creates a repository that doesn’t have a working directory, so you can't commit directly to it.
// git init --bare <directory>
N/B: the bare version of a repository called my-project should be stored in a directory called my-project.git.
The --bare flag creates a repository that doesn’t have a working directory, so you can't commit directly to it.

Since you can't edit files and commit changes in that repository, you would create a bare repository just to git push and git pull from, but never directly commit to it.
Think of --bare as a way to mark a repository as a storage facility, as opposed to a development environment
Think of --bare as a way to mark a repository as a storage facility, as opposed to a development environment
Saving changes
-git add - git commit - git diff - git stash - .gitignore
The commands: git add, git status, and git commit are used in combination to save a snapshot of a Git project's current state.
A Git repo can be configured to ignore specific files or directories.
-git add - git commit - git diff - git stash - .gitignore
The commands: git add, git status, and git commit are used in combination to save a snapshot of a Git project's current state.
A Git repo can be configured to ignore specific files or directories.
// git add
The git add command adds a change in the working directory to the staging area. It tells Git that you want to include updates to a particular file in the next commit.
However, changes are not actually recorded until you run git commit.
The git add command adds a change in the working directory to the staging area. It tells Git that you want to include updates to a particular file in the next commit.
However, changes are not actually recorded until you run git commit.

Git commits are actions in your project which saves and captures changes made to the source files.
Git commits can be captured and built up locally, then pushed to a remote server as needed using the git push -u origin master command.
Git commits can be captured and built up locally, then pushed to a remote server as needed using the git push -u origin master command.
Inspecting a repository
git status - git tag - git blame
The git status command displays the state of the working directory and the staging area. It lets you see which changes have been staged, which haven’t, and which files aren’t being tracked by Git.
git status - git tag - git blame
The git status command displays the state of the working directory and the staging area. It lets you see which changes have been staged, which haven’t, and which files aren’t being tracked by Git.

// git blame
The high-level function of git blame is the display of author metadata attached to specific committed lines in a file. This is used to explore the history of specific code and answer questions about what, how, and why the code was added to a repository.
The high-level function of git blame is the display of author metadata attached to specific committed lines in a file. This is used to explore the history of specific code and answer questions about what, how, and why the code was added to a repository.

// git log
The git log command displays committed snapshots. It lets you list the project history, filter it, and search for specific changes.
The git log command displays committed snapshots. It lets you list the project history, filter it, and search for specific changes.

Ignoring Files
Untracked files typically fall into 2 categories. Either files that have just been added to the project and haven't been committed yet, or they're compiled binaries: .pyc, .obj, .exe.
Git lets you ignore files by placing paths in a special file called .gitignore
Untracked files typically fall into 2 categories. Either files that have just been added to the project and haven't been committed yet, or they're compiled binaries: .pyc, .obj, .exe.
Git lets you ignore files by placing paths in a special file called .gitignore
Any files that you'd like to ignore should be included on a separate line, and the * symbol can be used as a wildcard. For example, adding the following to a .gitignore file in your project root will prevent compiled Python modules from appearing in git status:
*.pyc
*.pyc