/hello-github

GitHub Command Cheat Sheet Repository

Primary LanguageBatchfile

Git Resources and Basic Commands (Hello-Github)

Repository used to store useful git resources and basic git commands.

๐Ÿ›  Useful Resources

GitHub Octocat

๐Ÿ“ก Git Workflow Strategies

Commits

  • Commits should only include changes from the same topic in a single commit.
  • Commit message subject: Subject should be concise summary of what happened.
  • Commit message body: More detailed explanation (what is now different? Reason, etc...)

Branching

  • Consider creating a written branch convention to avoid collisions or mistakes.
    • e.g. Few branches, relatively small commits, high-quality testing & QA standards
  • Consider creating long-running and short-lived branches to enhance structures & workflows.
    • e.g. Release, Dev, Feature, Stages, etcโ€ฆ
  • Avoid direct commits. Always push the code to a development brush to be tested and reviewed before committing to it.
  • Take inspiration for branching from well structures already existing models such as โ€œGithub Flowโ€ or โ€œGitFlowโ€.

Other Considerations

  • Pull Requests: Fork (Personal Copy) -> Make Changes -> Make Pull request to include changes.

๐Ÿš€ Git Cheat Sheet

  • Opens Help Page

    • git config --help
  • Shows help for specific action

    • git <verb> --help
    • git help <verb>
  • Returns Version

    • git --version
  • Sets Initial Settings

    • git config --global user.name "FirstName LastName"
    • git config --global user.email "userEmail"
  • Returns Current Settings

    • git config --list
  • Initialize Directory

    • git init
  • Stop Tracking Directory

    • rm -rf .git
  • Create gitignore File

    • touch .gitignore

    e.g. *.pyc
    e.g. .DS_Store

  • Check Status of Current Directory

    • git status
  • Add All Files to Staging Area

    • git add .
    • git add -A
  • Add a Files to Staging Area

    • git add fileName.ext
  • Resets Entire Current Staging Area

    • git reset
  • Removes Specific File from Staging Area

    • git reset fileName.ext
  • Commit With Small Message

    • git commit -m "<message>"
  • Send Committed Files to Repository

    • git push
  • Show the Current Commit

    • git log
  • Cloning a Remote Repository

    • git clone <URL>
    • git clone <URL> <DIRECTORY>
  • Info about the Repository

    • git remote -v
  • Returns All Branches

    • git branch -a
  • Show Changes Since Last Commit

    • git diff
  • Download Changes (Should Pull after Pushing)

    • git pull
  • Create Branch

    • git branch <branch-name>
    • git branch
    • git checkout <branch-name>
    • git checkout -b <branch-name> (Create and switch to the branch)
  • Changes current remote repository

    • git remote set-url origin <URL>
    • git remote set-url origin https*//github.com/TrevisanGMW/hello-world.git
  • Shows difference between old and new file

    • git diff
  • Creates and Switches to branch for desired feature

    • git branch <New-Branch-Name>
    • git checkout <New-Branch-Name>
  • Push to Specific Branch

    • git push -u origin <New-Branch-Name>
  • Returns Branches that have been merged so far

    • git branch --merged
  • Merge Another Branch with Current Branch

    • git merge <Branch-Name>
    • git push origin master
  • Deleting a Branch

    • git branch --merged
    • git branch -d <Branch-Name>
    • git push origin --delete <Branch-Name>
  • Misc Commands:

    • git pull origin master (fetches commits from the master branch)
    • git checkout -b <branch-name> (-b : new branch)
    • git branch (tells you what branch you're using)
    • git push origin dev (pushes to specific branch)
    • git add -p fileName.ext (Allows for patch level commits)

๐Ÿ‘ป Commonly Used Emojis

ico shortcode ico shortcode
๐Ÿ˜‚ :joy: ๐Ÿ˜… :sweat_smile:
๐Ÿ˜‰ :wink: ๐Ÿ˜Š :blush:
๐Ÿฅฐ :smiling_face_with_three_hearts: ๐Ÿ˜ :heart_eyes:
๐Ÿคฉ :star_struck: ๐Ÿ˜˜ :kissing_heart:
๐Ÿ˜œ :stuck_out_tongue_winking_eye: ๐Ÿคช :zany_face:
๐Ÿคจ :raised_eyebrow: ๐Ÿค” :thinking:
๐Ÿ˜ :smirk: ๐Ÿ™„ :roll_eyes:
๐Ÿ˜ฌ :grimacing: ๐Ÿ˜ต :dizzy_face:
๐Ÿ˜Ž :sunglasses: ๐Ÿฅณ :partying_face:
๐Ÿค“ :nerd_face: ๐Ÿ˜ฑ :scream:
๐Ÿ˜ฒ :astonished: ๐Ÿ˜ฎ :open_mouth:
๐Ÿ˜ฒ :astonished: ๐Ÿ˜ฎ :open_mouth:
๐Ÿ‘ป :ghost: ๐Ÿ™ˆ :see_no_evil:
โค๏ธ :heart: ๐Ÿ’ฃ :bomb:
๐Ÿ‘‹ :wave: ๐Ÿค˜ :metal:
๐Ÿ‘ :thumbsup: ๐Ÿ™Œ :raised_hands:
๐Ÿ™… :no_good_woman: ๐Ÿ™…โ€โ™‚๏ธ :no_good_man:
๐Ÿคท :woman_shrugging: ๐Ÿคทโ€โ™‚๏ธ :man_shrugging:
๐Ÿ‘ฉโ€๐Ÿ’ป :woman_technologist: ๐Ÿ‘จโ€๐Ÿ’ป :man_technologist:
๐Ÿ‘จโ€๐Ÿš€ :man_astronaut: ๐Ÿง™ :mage:
๐Ÿƒโ€โ™€๏ธ :running_woman: ๐Ÿƒโ€โ™‚๏ธ :running_man:
๐Ÿฆ :raccoon: ๐Ÿ‘ฃ :footprints:
๐Ÿง :penguin: ๐Ÿน :hamster:
๐Ÿฆœ :parrot: ๐Ÿฆ† :duck:
๐Ÿ :snake: ๐Ÿฆ• :sauropod:
๐Ÿ™ :octopus: ๐Ÿณ :whale:
๐Ÿ•ท๏ธ :spider: ๐Ÿ•ธ๏ธ :spider_web:
๐ŸŒท :tulip: ๐Ÿ :maple_leaf:
๐Ÿ‰ :watermelon: ๐Ÿ’ :cherries:
๐Ÿฅ• :carrot: ๐Ÿ† :eggplant:
๐Ÿ– :meat_on_bone: ๐Ÿ— :poultry_leg:
๐Ÿ• :pizza: ๐Ÿฆž :lobster:
๐Ÿฉ :doughnut: ๐Ÿช :cookie:
๐Ÿฌ :candy: ๐ŸŽ‚ :birthday:
โ˜• :coffee: ๐Ÿงƒ :beverage_box:
๐ŸŒŽ :earth_americas: ๐Ÿ—๏ธ :building_construction:
๐Ÿš‚ :steam_locomotive: ๐Ÿš— :car:
๐Ÿš€ :rocket: ๐ŸŒก๏ธ :thermometer:
๐ŸŒŸ :star2: ๐ŸŒŒ :milky_way:
โ˜ƒ๏ธ :snowman_with_snow: ๐ŸŽˆ :balloon:
๐Ÿ’ง :droplet: ๐Ÿ”ฅ :fire:
๐Ÿงจ :firecracker: ๐ŸŽ‰ :tada:
๐ŸŽฎ :video_game: ๐ŸŽŠ :confetti_ball:
๐Ÿ•น๏ธ :joystick: ๐Ÿ’Ž :gem:
๐ŸŽง :headphones: ๐ŸŽบ :trumpet:
๐Ÿ“• :closed_book: ๐Ÿ“— :green_book:
๐Ÿ“˜ :blue_book: ๐Ÿ“™ :orange_book:
๐Ÿ“š :books: ๐Ÿ““ :notebook:
๐Ÿ“œ :scroll: ๐Ÿ“ƒ :page_with_curl:
๐Ÿ–Œ๏ธ :paintbrush: โœ๏ธ :pencil2:
๐Ÿ“Œ :pushpin: ๐Ÿ“ :round_pushpin:
โœ‚๏ธ :scissors: ๐Ÿ”‘ :key:
๐Ÿ”จ :hammer: ๐Ÿช“ :axe:
โ›๏ธ :pick: โš’๏ธ :hammer_and_pick:
๐Ÿ› ๏ธ :hammer_and_wrench: ๐Ÿ”ซ :gun:
โš™๏ธ :gear: ๐Ÿงฐ :toolbox:
๐Ÿ“ก :satellite: ๐Ÿงฌ :dna:
๐Ÿ’‰ :syringe: ๐Ÿฉธ :drop_of_blood:
๐Ÿ›’ :shopping_cart: โ˜ข๏ธ :radioactive:
โ“ :question: โ€ผ๏ธ :bangbang:
โœ”๏ธ :heavy_check_mark: โŒ :x:
๐ŸŸข :green_circle: ๐Ÿ”ด :red_circle:
๐Ÿดโ€โ˜ ๏ธ :pirate_flag: โš ๏ธ :warning: