Day 12: Cheatsheet for Linux and Git-Github

Day 12: Cheatsheet for Linux and Git-Github

ยท

3 min read

Introduction :

Whether you're a seasoned developer or just starting your coding journey, having a handy cheat sheet of essential commands can be a real lifesaver. In this comprehensive guide, we've compiled a well-articulated and documented list of Linux, Git, and GitHub commands, along with brief explanations of their usage. So, let's dive right in and supercharge your coding experience! ๐Ÿ’ป๐Ÿ“

Linux Commands ๐Ÿง:

  1. ls - List files and directories. Usage: ls [options] [directory] Example: ls -l

  2. cd - Change the current directory. Usage: cd [directory] Example: cd Documents

  3. mkdir - Create a new directory. Usage: mkdir [directory_name] Example: mkdir my_folder

  4. rm - Remove files or directories. Usage: rm [options] [file/directory] Example: rm -rf my_folder

  5. cp - Copy files or directories. Usage: cp [options] [source] [destination] Example: cp file.txt /new_location

  6. mv - Move or rename files/directories. Usage: mv [options] [source] [destination] Example: mv file.txt new_name.txt

  7. pwd - Print the current working directory. Usage: pwd

  8. grep - Search for patterns in files. Usage: grep [options] [pattern] [file] Example: grep "keyword" file.txt

Git Commands ๐Ÿ™:

  1. git init - Initialize a new Git repository. Usage: git init

  2. git clone - Clone a repository to your local machine. Usage: git clone [repository_url] Example: git clone https://github.com/username/repository.git

  3. git add - Add changes to the staging area. Usage: git add [file] Example: git add file.txt

  4. git commit - Commit staged changes. Usage: git commit -m "Commit message" Example: git commit -m "Add new feature"

  5. git pull - Fetch and merge changes from a remote repository. Usage: git pull [remote] [branch] Example: git pull origin main

  6. git push - Push local commits to a remote repository. Usage: git push [remote] [branch] Example: git push origin main

  7. git branch - List, create, or delete branches. Usage: git branch [options] [branch_name] Example: git branch new_feature

GitHub Commands ๐ŸŒ:

  1. git remote - Manage remote repositories. Usage: git remote [options] [add/remove/show] [name] [url] Example: git remote add origin https://github.com/username/repository.git

  2. git fork - Fork a repository on GitHub. Usage: git fork

  3. git pull-request - Create a pull request on GitHub. Usage: git pull-request Example: git pull-request -m "Fix typo"

  4. git merge - Merge changes from one branch to another. Usage: git merge [source_branch] Example: git merge feature_branch

  5. git checkout - Switch between branches. Usage: git checkout [branch_name] Example: git checkout develop

  6. git log - Display commit history. Usage: git log [options] Example: git log --oneline

Conclusion :

Congratulations on completing our Ultimate Cheat Sheet for Linux, Git, and GitHub commands! You've now armed yourself with a powerful tool that will undoubtedly boost your productivity and efficiency as a developer. By mastering these commands, you're well-equipped to navigate the Linux terminal, manage version control with Git, and collaborate seamlessly on GitHub projects.

ย