Hi,๐Ÿ‘‹ we have updated the app and fixed multiple bugs. We are lacking funds, request to free user not to use Adblock. Ads are non intrusive. ๐Ÿ˜Š

โœจ Visual Editor

close

palette Canvas & Background

Gradient:arrow_forward
Text Color:
135ยฐ

style Card Style

40px
16px

text_fields Typography

16px
Dr Milan Milanoviฤ‡
@milan_milanovic
๐—›๐—ผ๐˜„ ๐—š๐—œ๐—ง ๐—ช๐—ผ๐—ฟ๐—ธ๐˜€

Git is a distributed version control tool that facilitates monitoring changes made to your code over time. Git makes it simple to track changes to your codebase and collaborate on projects with others. It was authored by Linus Torvalds in 2005 for developing the ๐—Ÿ๐—ถ๐—ป๐˜‚๐˜… ๐—ธ๐—ฒ๐—ฟ๐—ป๐—ฒ๐—น, with other kernel developers contributing to its initial development.

It enables us to ๐˜๐—ฟ๐—ฎ๐—ฐ๐—ธ ๐—ฐ๐—ต๐—ฎ๐—ป๐—ด๐—ฒ๐˜€ ๐—ถ๐—ป ๐—ผ๐˜‚๐—ฟ ๐—ฐ๐—ผ๐—ฑ๐—ฒ ๐—ฎ๐—ป๐—ฑ ๐—ฐ๐—ผ๐—น๐—น๐—ฎ๐—ฏ๐—ผ๐—ฟ๐—ฎ๐˜๐—ฒ ๐˜„๐—ถ๐˜๐—ต ๐—ผ๐˜๐—ต๐—ฒ๐—ฟ๐˜€, by working on a different part of a codebase. When we say distributed, we may think we have code on two locations, remote server and locally, but the story is a bit more complex.

Git has three local storages: a working directory, a staging area, and a local repository.

๐Ÿญ. ๐—ช๐—ผ๐—ฟ๐—ธ๐—ถ๐—ป๐—ด ๐——๐—ถ๐—ฟ๐—ฒ๐—ฐ๐˜๐—ผ๐—ฟ๐˜† - This is where you work, and your files live (also called "untracked"). All file changes here will be marked, and if they are not saved to GIT, you will lose them. The reason is that GIT is not aware of those files.

๐Ÿฎ. ๐—ฆ๐˜๐—ฎ๐—ด๐—ถ๐—ป๐—ด ๐—”๐—ฟ๐—ฒ๐—ฎ - When you save your changes with git add, GIT will start tracking and saving your changes with files. These changes are stored in the .git directory. Then, files are moved from the Working Directory to the Staging Area. Still, if you change these files, GIT will not know about them; you need to tell GIT to notice those changes.

๐Ÿฏ. ๐—Ÿ๐—ผ๐—ฐ๐—ฎ๐—น ๐—ฅ๐—ฒ๐—ฝ๐—ผ๐˜€๐—ถ๐˜๐—ผ๐—ฟ๐˜† - It is the area where everything is saved (commits) in the .git directory. When you want to move your files from the Staging Area to the Local Repository, you can use the git commit command. After this, your Staging area will be empty. If you want to see what is in the Local repository, try git log.

Some basic ๐—š๐—œ๐—ง ๐—ฐ๐—ผ๐—บ๐—บ๐—ฎ๐—ป๐—ฑ๐˜€ are:

๐Ÿ”น ๐—ด๐—ถ๐˜ ๐—ถ๐—ป๐—ถ๐˜ -> Create a new git repo in the directory
๐Ÿ”น ๐—ด๐—ถ๐˜ ๐—ฏ๐—ฟ๐—ฎ๐—ป๐—ฐ๐—ต -> Create a new local branchย 
๐Ÿ”น ๐—ด๐—ถ๐˜ ๐—ฐ๐—ต๐—ฒ๐—ฐ๐—ธ๐—ผ๐˜‚๐˜ -> Switch branches
๐Ÿ”น ๐—ด๐—ถ๐˜ ๐—ฎ๐—ฑ๐—ฑ -> Add a new file to your staging area
๐Ÿ”น ๐—ด๐—ถ๐˜ ๐—ฐ๐—ผ๐—บ๐—บ๐—ถ๐˜ -> Adds staged changes to your local repository
๐Ÿ”น ๐—ด๐—ถ๐˜ ๐—ฝ๐˜‚๐—น๐—น -> pull code from your remote repo to your local directory
๐Ÿ”น ๐—ด๐—ถ๐˜ ๐—ฝ๐˜‚๐˜€๐—ต -> Push local repository changes to your remote repo
๐Ÿ”น ๐—ด๐—ถ๐˜ ๐˜€๐˜๐—ฎ๐˜๐˜‚๐˜€ -> Show which files are being tracked (and untracked)
๐Ÿ”น ๐—ด๐—ถ๐˜ ๐—ฑ๐—ถ๐—ณ๐—ณ -> See the actual difference in code between your Working Directory and your Staging Area

Along with GIT commands, you can try and use some popular ๐—š๐—œ๐—ง ๐˜๐—ผ๐—ผ๐—น๐˜€: GitHub Desktop, SourceTree, TortoiseGit, Git Extensions, GitKraken, SmartGit, Tower, etc.

#developers
Thread image
Dr Milan Milanoviฤ‡
@milan_milanovic
Git Cheat Sheet
Thread image
Dr Milan Milanoviฤ‡
@milan_milanovic
To expand your knowledge and personal growth, subscribe to my free weekly newsletter with 20,000+ people: https://t.co/MMCXxQQR4F.
Generated by Thread Navigator
100%
view_carousel Carousel Studio NEW
Press โŒ˜ + S to quick-export