Add Git Basics To Your Skillset Now!

 Add Git Basics To Your Skillset Now!
Okunuyor Add Git Basics To Your Skillset Now!

The today over lesson is about the Add Git Basics To Your Skillset Now!, I hope this lesson is useful for you.

Pre-Requisites

Git Init

This command will create a git repository in the curent directory.

A repository is a file location where all files and folders related to your project alongwith the change history are stored.

Git Add

git add hello.pd

git add <filename>

git add -A

(adds all changed files)

Add is used for adding changes in our project to the staging area before commit. It’s like packing up things that have been modified to be sent to the main factory. Hpoe you ge it

Git Commit

git commit -m “message”

Commits are used to save changes and create something similar to a version of your project which you can return back to when needed.

Here -m “message” is used to add a note to the commit and describe what it is about to the future you and your team-metes 😛

Git Brance

git branch newBranchName

Branches are useful for creating a new working directory for a specific task. It is used when you want to work on a project without affecting the main code.

eg: git branch feature

Imagine a teammate wanting to add a new feature to the project without affecting your main code.

Master feature

Git Checkout

git checkout branchName

Every projects has one branch by default called the master. By default you are on the master branch. To mve onto another branch and work on it you use this command.

execute git branch command to show all branches and also the active branch. The active branch will have * at the end

Git Merge

git merge branchName

This is the simplest way of merging or integrating changes from one branch to another branch. This topic required a much detailed post. But for now understand that this is used for integrating the branchName branch in to the active branch (default master).

Example

Let’s do an example to recap what we learend till now

  • Git Init
    • /Creates a new git repo (repository)
    • /Create an empty text file in that directory
  • Git Add FileName
    • /Setting files for comit
  • Git commit -m “First Commit”
    • /Creates a new commit with the added
    • /Changes
  • Git CheckOut -b branchName
    • /This is new! Creates a new branch and
    • /checkout it in one line!
    • /Couldn’t fit merge here: P

Yapılan Yorumlar

Bir Cevap Yazın

This site uses Akismet to reduce spam. Learn how your comment data is processed.