Sunday, March 3, 2024

Git

 Jump into Git with these starter commands:



🌟 𝚐𝚒𝚝 𝚒𝚗𝚒𝚝: Kick things off with this command that creates a new Git repository right where you are.

🔄 𝚐𝚒𝚝 𝚌𝚕𝚘𝚗𝚎 <𝚛𝚎𝚙𝚘>: Want to get cracking on an existing project? This command copies it over to your local machine.

𝗠𝗮𝗸𝗶𝗻𝗴 𝗖𝗵𝗮𝗻𝗴𝗲𝘀


🔍 𝚐𝚒𝚝 𝚜𝚝𝚊𝚝𝚞𝚜: Take a quick peek at what's changed with this command. It's good practice to check in before and after you make changes.

➕ 𝚐𝚒𝚝 𝚊𝚍𝚍 <𝚏𝚒𝚕𝚎𝚗𝚊𝚖𝚎>: Made some tweaks? Stage them for a commit with this command that adds your files to the lineup.

📦 𝚐𝚒𝚝 𝚊𝚍𝚍 . or 𝚐𝚒𝚝 𝚊𝚍𝚍 -𝙰: Why add files one at a time when you can add all your changes in one fell swoop?

💾 𝚐𝚒𝚝 𝚌𝚘𝚖𝚖𝚒𝚝 -𝚖 "𝙲𝚘𝚖𝚖𝚒𝚝 𝚖𝚎𝚜𝚜𝚊𝚐𝚎": Seal the deal on your changes with a commit and a handy message to remind you what you did.

𝗕𝗿𝗮𝗻𝗰𝗵𝗶𝗻𝗴 𝗢𝘂𝘁


📋 𝚐𝚒𝚝 𝚋𝚛𝚊𝚗𝚌𝚑: Curious about your branches? List them all out with this simple command.

🌱 𝚐𝚒𝚝 𝚋𝚛𝚊𝚗𝚌𝚑 <𝚋𝚛𝚊𝚗𝚌𝚑𝚗𝚊𝚖𝚎>: Grow your project with a new branch using this command.

🔄 𝚐𝚒𝚝 𝚌𝚑𝚎𝚌𝚔𝚘𝚞𝚝 <𝚋𝚛𝚊𝚗𝚌𝚑𝚗𝚊𝚖𝚎>: Jump over to another branch to keep working seamlessly.

🔗 𝚐𝚒𝚝 𝚖𝚎𝚛𝚐𝚎 <𝚋𝚛𝚊𝚗𝚌𝚑𝚗𝚊𝚖𝚎>: Done with changes on your side branch? Bring them back to the main branch with a merge.

𝗪𝗼𝗿𝗸𝗶𝗻𝗴 𝘄𝗶𝘁𝗵 𝗥𝗲𝗺𝗼𝘁𝗲𝘀


📤 𝚐𝚒𝚝 𝚙𝚞𝚜𝚑 𝚘𝚛𝚒𝚐𝚒𝚗 <𝚋𝚛𝚊𝚗𝚌𝚑𝚗𝚊𝚖𝚎>: Send your latest commits up to the cloud with this push command.

📥 𝚐𝚒𝚝 𝚙𝚞𝚕𝚕: Stay up-to-date with the rest of the team's work by pulling in their changes.

🔗 𝚐𝚒𝚝 𝚛𝚎𝚖𝚘𝚝𝚎 -𝚟: Check your connections with this command that lists remote repositories linked to your local repo.

𝗨𝗻𝗱𝗲𝗿𝘀𝘁𝗮𝗻𝗱𝗶𝗻𝗴 𝘁𝗵𝗲 𝗗𝗶𝗳𝗳𝗲𝗿𝗲𝗻𝗰𝗲𝘀


🔽 𝚐𝚒𝚝 𝚏𝚎𝚝𝚌𝚑 vs 𝚐𝚒𝚝 𝚙𝚞𝚕𝚕: Both bring data from remote repositories, but 𝚐𝚒𝚝 𝚏𝚎𝚝𝚌𝚑 is like previewing, while 𝚐𝚒𝚝 𝚙𝚞𝚕𝚕 is like downloading and updating your files in one go.

🔀 𝚐𝚒𝚝 𝚖𝚎𝚛𝚐𝚎 vs 𝚐𝚒𝚝 𝚛𝚎𝚋𝚊𝚜𝚎: Both integrate changes from one branch to another, but 𝚐𝚒𝚝 𝚖𝚎𝚛𝚐𝚎 makes a new commit for it, while 𝚐𝚒𝚝 𝚛𝚎𝚋𝚊𝚜𝚎 keeps your history neat and tidy.

↩️ 𝚐𝚒𝚝 𝚛𝚎𝚜𝚎𝚝 vs 𝚐𝚒𝚝 𝚛𝚎𝚟𝚎𝚛𝚝: Need to backtrack? Use 𝚐𝚒𝚝 𝚛𝚎𝚜𝚎𝚝 to discard changes or 𝚐𝚒𝚝 𝚛𝚎𝚟𝚎𝚛𝚝 to undo while keeping your commit history intact.

Git is an extremely powerful tool with plenty more commands and options.

However, this post gives you a good start and reference point as you continue to explore and leverage Git for your version control needs.

No comments: