Master Git with these simple commands

🤔 𝗖𝗼𝗻𝗳𝘂𝘀𝗲𝗱 𝘄𝗶𝘁𝗵 𝗚𝗶𝘁 𝗖𝗼𝗺𝗺𝗮𝗻𝗱𝘀? 𝗛𝗲𝗿𝗲’𝘀 𝘁𝗵𝗲 𝗨𝗹𝘁𝗶𝗺𝗮𝘁𝗲 𝗦𝗼𝗹𝘂𝘁𝗶𝗼𝗻 If you’ve ever been stuck or confused about the right Git command, don’t worry! Here’s a handy guide to help you streamline your workflow and master Git in no time. 𝗴𝗶𝘁 𝗱𝗶𝗳𝗳: See the changes not yet staged. 𝗴𝗶𝘁 𝗰𝗼𝗺𝗺𝗶𝘁 -𝗮 -𝗺 "𝗰𝗼𝗺𝗺𝗶𝘁 𝗺𝗲𝘀𝘀𝗮𝗴𝗲": Commit all changes with a message. 𝗴𝗶𝘁 𝗰𝗼𝗺𝗺𝗶𝘁 --𝗮𝗺𝗲𝗻𝗱: Modify the last commit. 𝗴𝗶𝘁 𝘀𝘁𝗮𝘁𝘂𝘀: Check the status of your working directory. 𝗴𝗶𝘁 𝗮𝗱𝗱 <𝗳𝗶𝗹𝗲_𝗽𝗮𝘁𝗵>: Stage your files for commit. 𝗴𝗶𝘁 𝗰𝗵𝗲𝗰𝗸𝗼𝘂𝘁 -𝗯 <𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲>: Create and switch to a new branch. 𝗴𝗶𝘁 𝗰𝗵𝗲𝗰𝗸𝗼𝘂𝘁 <𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲>: Switch to an existing branch. 𝗴𝗶𝘁 𝗰𝗵𝗲𝗰𝗸𝗼𝘂𝘁 <𝗰𝗼𝗺𝗺𝗶𝘁_𝗶𝗱>: Checkout to a specific commit. 𝗴𝗶𝘁 𝗽𝘂𝘀𝗵 𝗼𝗿𝗶𝗴𝗶𝗻 <𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲>: Push your changes to the remote repository. 𝗴𝗶𝘁 𝗽𝘂𝗹𝗹: Fetch and merge remote changes. 𝗴𝗶𝘁 𝗳𝗲𝘁𝗰𝗵: Fetch updates from the remote repository without merging. 𝗴𝗶𝘁 𝗿𝗲𝗯𝗮𝘀𝗲 -𝗶: Rebase interactively and rewrite commit history. 𝗴𝗶𝘁 𝗿𝗲𝗯𝗮𝘀𝗲 <𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲>: Rebase your current branch onto another. 𝗴𝗶𝘁 𝗰𝗹𝗼𝗻𝗲: Clone a repository to your local machine. 𝗴𝗶𝘁 𝗺𝗲𝗿𝗴𝗲: Merge two branches together. 𝗴𝗶𝘁 𝗹𝗼𝗴 --𝘀𝘁𝗮𝘁: See commit logs with stats. 𝗴𝗶𝘁 𝘀𝘁𝗮𝘀𝗵: Stash your changes temporarily. 𝗴𝗶𝘁 𝘀𝘁𝗮𝘀𝗵 𝗽𝗼𝗽: Apply and remove stashed changes. 𝗴𝗶𝘁 𝘀𝗵𝗼𝘄 <𝗰𝗼𝗺𝗺𝗶𝘁_𝗶𝗱>: View details of a commit. 𝗴𝗶𝘁 𝗿𝗲𝘀𝗲𝘁 𝗛𝗘𝗔𝗗~𝟭: Undo the last commit while keeping the changes locally. 𝗴𝗶𝘁 𝗯𝗿𝗮𝗻𝗰𝗵 -𝗗 <𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲>: Force delete a branch. 𝗴𝗶𝘁 𝗿𝗲𝘀𝗲𝘁: Undo commits and move the branch reference. 𝗴𝗶𝘁 𝗿𝗲𝘃𝗲𝗿𝘁 <𝗰𝗼𝗺𝗺𝗶𝘁_𝗶𝗱>: Revert a commit by creating a new commit that undoes it. 𝗴𝗶𝘁 𝗰𝗵𝗲𝗿𝗿𝘆-𝗽𝗶𝗰𝗸 <𝗰𝗼𝗺𝗺𝗶𝘁_𝗶𝗱>: Apply changes from a specific commit. 𝗴𝗶𝘁 𝗯𝗿𝗮𝗻𝗰𝗵: List all branches in your repo. 𝗴𝗶𝘁 𝗿𝗲𝘀𝗲𝘁 --𝘀𝗼𝗳𝘁 𝗛𝗘𝗔𝗗^: Undo the last commit but keep your changes. 𝗴𝗶𝘁 𝗿𝗲𝘀𝗲𝘁 --𝗵𝗮𝗿𝗱: Hard reset to a previous commit and discard uncommitted changes. 𝗴𝗶𝘁 𝗯𝗿𝗮𝗻𝗰𝗵 --𝘀𝗲𝘁-𝘂𝗽𝘀𝘁𝗿𝗲𝗮𝗺-𝘁𝗼 <𝗿𝗲𝗺𝗼𝘁𝗲_𝗯𝗿𝗮𝗻𝗰𝗵>: Set upstream for your branch. 𝗦𝗮𝘆 𝗴𝗼𝗼𝗱𝗯𝘆𝗲 𝘁𝗼 𝗰𝗼𝗻𝗳𝘂𝘀𝗶𝗼𝗻 𝗮𝗻𝗱 𝗲𝗹𝗲𝘃𝗮𝘁𝗲 𝘆𝗼𝘂𝗿 𝗚𝗶𝘁 𝗴𝗮𝗺𝗲 𝘄𝗶𝘁𝗵 𝘁𝗵𝗲𝘀𝗲 𝘀𝗶𝗺𝗽𝗹𝗲 𝗰𝗼𝗺𝗺𝗮𝗻𝗱𝘀 #devops #softwareengineering #techcommunity #git #versioncontrol #github #developers

  • No alternative text description for this image

Absolute lifesaver Nadeem Ahmad! Nothing like a clear Git roadmap to cut through the chaos.

To view or add a comment, sign in

Explore content categories