Lädt...

🔧 Git Commands You Need for Hacktoberfest 2024 - Git cheat sheet


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

Hello, aspiring developer!

Are you ready to level up your GitHub skills and make an impact in the open-source world? As Hacktoberfest is in full swing, and we’re just two weeks in, there's no better time to start contributing and boosting your expertise.

I know it’s been a while, but I’m excited to share some cool content I’ve been working on, and from now on, I’ll be posting regularly.

So, get ready for an exciting journey that will take you from a beginner to a Hacktoberfest pro. Let’s dive in and explore the world of Git commands together!

Configure name and email with Git

If you are a beginner into this git and github things and if you just install the git for first time or say on a new machine then you need to configure some data to use the git into your local system. Here are the few steps which you can follow copy paste the below command into your any terminal and make sure you change the user.name and user.email with your actual details

# set name and email (example name and email Id)
git config --global user.name "paruidev"
git config --global user.email "[email protected]"

# set default branch name (optional)
git config --global init.defaultBranch main

Simple Git Workflow

Cloning a Repository

Clone a remote repository to your local machine, bringing the entire project history and all its branches to your computer. This allows you to work on the project offline and contribute changes back to the original repository.

git clone <repository-url>

You can copy the repository URL from the repo's GitHub page.

Check Repository Status

Check the status of your working directory to see which files have been modified, added, or deleted since your last commit. This command provides a snapshot of your current project state, helping you track changes and prepare for staging.

git status

This command shows which files are changes, which ones are added for committing, etc.

Adding Changes

Stage changes by adding files to the staging area in preparation for committing. This crucial step allows you to selectively choose which modifications you want to include in your next commit, giving you fine-grained control over your version history. By staging changes, you can review and organize your work before permanently recording it in the repository.

git add <file-name>

Commit Changes

After staging, commit changes with a meaningful message.

git commit -m "Commit message"

Viewing Commit History

Check your commit history.

git log

For a simpler, one-line format:

git log --oneline

Push Changes to Remote

Push committed changes to the remote repository.

git push

Create Branches and Merge it

Branching allows you to work on different parts of your project independently. Here's how to manage branches:

Create a New Branch

Create a new branch for your feature or bug fix.

git switch -c <branch-name>

If you just want to create the new branch and don't want to switch to it:

git branch -c <branch-name>

Switch to Another Branch

if you want to switch to another branch

git switch <branch-name>

List All Branches

See all branches in your repository.

git branch

Merge a Branch

Merge changes from one branch into your current branch.

git merge <branch-name>

Delete a Branch

Once a branch is no longer needed, you can delete it. but make sure once it done it can’t be revert back. So do with your own risk.

# Locally
git branch -d <branch-name>

# Remotely
git push origin --delete <branch-name>

Save Code in Stashing.

Stashing temporarily stores your changes without committing them.

Save Changes to a Stash

If you're working on something and want to switch branches without committing:

git stash

Apply Stash

To retrieve your changes later:

git stash apply

List Stashed Changes

If you have multiple stashes, you can see them with:

git stash list

Hacktoberfest is more than just a month-long event—it's an opportunity to grow and give back to the developer community. With this cheat sheet, you're equipped to tackle GitHub challenges head-on.

Remember, every contribution counts, so dive in, learn, and enjoy the journey!. Let me know how many repository is approved till now done with your hacktober fest contribution and which types of repository you’ve contributed to I'm exited to know about it.

Explore paruidev for in-depth guides & some tip and tricks. Also If you all have any quires and doubts feel free to have your questions into comment section I'm happy to help you.

Happy Hacking all of you!

...

🐧 Unix Commands Cheat Sheet: All the Commands You Need


📈 53.17 Punkte
🐧 Linux Tipps

🐧 Linux Command Line Cheat Sheet: All the Commands You Need


📈 43.46 Punkte
🐧 Linux Tipps

📰 Windows PowerShell Commands Cheat Sheet – The Ultimate Guide You Need


📈 43.46 Punkte
🖥️ Betriebssysteme

📰 Ransomware Cheat Sheet: Everything You Need To Know In 2024


📈 36.17 Punkte
📰 IT Security Nachrichten

🔧 The Ultimate Cheat Sheet: CLI Man Pages, tldr, and cheat.sh


📈 35.78 Punkte
🔧 Programmierung

🔧 The Ultimate Cheat Sheet: CLI Man Pages, tldr, and cheat.sh


📈 35.78 Punkte
🔧 Programmierung

🔧 Docker Commands Cheat Sheet


📈 34 Punkte
🔧 Programmierung

🔧 Docker Commands Cheat Sheet


📈 34 Punkte
🔧 Programmierung

🔧 Quick SQL guide and cheat sheet: Essential Commands


📈 34 Punkte
🔧 Programmierung

🔧 Windows CMD Commands Cheat Sheet


📈 34 Punkte
🔧 Programmierung

🔧 Vagrant CLI Commands Cheat Sheet


📈 34 Punkte
🔧 Programmierung

🔧 Docker Cheat Sheet - Most Useful Commands


📈 34 Punkte
🔧 Programmierung

📰 Top 10 Unlocking UNIX Commands Cheat sheet: Your Ultimate Command-line


📈 34 Punkte
📰 IT Security Nachrichten

🔧 Terraform Commands Cheat Sheet


📈 34 Punkte
🔧 Programmierung

🐧 50 Bash Commands Cheat Sheet


📈 34 Punkte
🐧 Linux Tipps

🔧 Linux Commands Cheat Sheet


📈 34 Punkte
🔧 Programmierung

🔧 Docker Commands Cheat Sheet


📈 34 Punkte
🔧 Programmierung

📰 Arch Linux Cheat Sheet: Essential Commands for New Users


📈 34 Punkte
🐧 Unix Server

🔧 Docker Commands Cheat Sheet


📈 34 Punkte
🔧 Programmierung

🔧 🚀 Arch Linux Cheat Sheet: Essential Commands for new Users


📈 34 Punkte
🔧 Programmierung

🔧 Kubernetes Cheat Sheet: Must-Know Commands and Examples


📈 34 Punkte
🔧 Programmierung

🔧 🐧 Linux Command Cheat Sheet: Essential Commands with Examples


📈 34 Punkte
🔧 Programmierung

🐧 FreeBSD Commands Cheat Sheet


📈 34 Punkte
🐧 Linux Tipps

🔧 Linux Commands Cheat Sheet :)


📈 34 Punkte
🔧 Programmierung

🐧 The Linux Commands Reference Cheat Sheet


📈 34 Punkte
🐧 Linux Tipps

🔧 Kubernetes Cheat Sheet: Essential Commands for Beginners


📈 34 Punkte
🔧 Programmierung

🐧 Kali Linux Commands cheat sheet


📈 34 Punkte
🐧 Linux Tipps

🔧 Batch Script Commands Cheat Sheet :)


📈 34 Punkte
🔧 Programmierung

🐧 This is my personal linux commands cheat sheet. Not perfect but pretty useful for me


📈 34 Punkte
🐧 Linux Tipps

🔧 Batch Script Commands Cheat Sheet :)


📈 34 Punkte
🔧 Programmierung

🐧 Some Linux Commands &quot;Cheat-sheet&quot;


📈 34 Punkte
🐧 Linux Tipps

🔧 Windows Commands Cheat Sheet :)


📈 34 Punkte
🔧 Programmierung

🔧 Complete GitHub Commands Cheat Sheet


📈 34 Punkte
🔧 Programmierung

🔧 Gradle Commands Cheat Sheet


📈 34 Punkte
🔧 Programmierung

🔧 Cheat sheet of 'Alembic' commands


📈 34 Punkte
🔧 Programmierung