DEV Community

Cover image for Git/GitHub Commands
Lupita Rivera
Lupita Rivera

Posted on • Edited on

2

Git/GitHub Commands

Git is a version control system that allows developers to track and manage changes to their codebase. GitHub is a platform that provides hosting for Git repositories, as well as tools for collaboration and version control. In this blog post, we'll explore some common Git/GitHub commands that you may find useful when working with Git and GitHub.

git init: This command initializes a new Git repository in the current directory.

git clone: This command creates a local copy of a remote repository. For example, git clone https://github.com/user/repo.git will create a local copy of the repository located at https://github.com/user/repo.git.

git add: This command adds a file to the staging area. For example, git add file.txt will add file.txt to the staging area.

git commit: This command saves changes to the local repository. For example, git commit -m "Added new feature" will commit all staged changes with the message "Added new feature".

git push: This command pushes local commits to a remote repository. For example, git push origin master will push all local commits to the master branch of the origin remote.

git pull: This command fetches and merges changes from a remote repository. For example, git pull origin master will fetch and merge changes from the master branch of the origin remote.

git branch: This command allows you to create, list, or delete branches. For example, git branch new-feature will create a new branch called new-feature, git branch will list all branches, and git branch -d new-feature will delete the new-feature branch.

git merge: This command merges one branch into another. For example, git merge new-feature will merge the new-feature branch into the current branch.

These are just a few of the many Git/GitHub commands that are available. With these commands, you should be able to get started working with Git and GitHub to track and manage changes to your codebase. :)

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay