Getting Started with Git-
ðīðķð ðķðŧðķð : This is the very first command you'll need to use when starting a new project. It initializes a new Git repository in your current directory.
ðīðķð ð°ðđðžðŧðē <ðŋðēð―ðž> : To work on an existing project, you'll want to clone (copy) it to your local machine. This command does that.
ð ðŪðļðē ððĩðŪðŧðīðēð
Git
ðīðķð ðððŪððð : Before making or after making changes, it's good practice to check the status of your files. This command will show you any changes that are currently unstaged.
ðīðķð ðŪðąðą <ðģðķðđðēðŧðŪðšðē> : After you've made some changes to your files, you'll want to stage them for a commit. This command adds a specific file to the stage.
ðīðķð ðŪðąðą . ðžðŋ ðīðķð ðŪðąðą -ð : Instead of adding files one by one, you can add all your changed files to the stage with one command.
ðīðķð ð°ðžðšðšðķð -ðš "ððžðšðšðķð ðšðēðððŪðīðē" : Now that your changes are staged, you can commit them with a descriptive message.
ððŋðŪðŧð°ðĩðķðŧðī
ðīðķð ðŊðŋðŪðŧð°ðĩ : This command will list all the local branches in your current repository.
ðīðķð ðŊðŋðŪðŧð°ðĩ <ðŊðŋðŪðŧð°ðĩðŧðŪðšðē> : This command creates a new branch.
ðīðķð ð°ðĩðēð°ðļðžðð <ðŊðŋðŪðŧð°ðĩðŧðŪðšðē> : If you want to switch to a different branch, use this command.
ðīðķð ðšðēðŋðīðē <ðŊðŋðŪðŧð°ðĩðŧðŪðšðē> : Once you've finished making changes in a branch, you'll want to bring those changes into your main branch (usually master). This command does that.
ðĨðēðšðžððē ðĨðēð―ðžððķððžðŋðķðēð
ðīðķð ð―ðððĩ ðžðŋðķðīðķðŧ <ðŊðŋðŪðŧð°ðĩðŧðŪðšðē> : This command sends your commits to the remote repository.
ðīðķð ð―ððđðđ : If other people are also working on your project, you'll want to keep your local repo up-to-date with their changes. This command fetches and merges any changes from the remote repository.
ðīðķð ðŋðēðšðžððē -ð : To check which remote servers are connected with your local repository.
ððēð ððķðģðģðēðŋðēðŧð°ðēð
ðīðķð ðģðēðð°ðĩ ðð ðīðķð ð―ððđðđ: Both download data from a remote repository. However, git fetch just downloads it without integrating it, while git pull also merges it into your local files.
ðīðķð ðšðēðŋðīðē ðð ðīðķð ðŋðēðŊðŪððē: Both incorporate changes from one branch to another. git merge combines the source and target branches via a new commit, whereas git rebase moves or combines commits to a new base, making a cleaner history.
ðīðķð ðŋðēððēð ðð ðīðķð ðŋðēððēðŋð: Both are used to undo changes. git reset discards local changes completely, while git revert undoes public changes by creating a new reversing commit, thereby preserving history.
Git is an extremely powerful tool with plenty more commands and options.
However, this guide gives you a good start and reference point as you continue to explore and leverage Git for your version control needs.
Top comments (0)