Basic Git commands
Here are the list of some basic Git commands that every beginners should know.
1 | Create a new repository | create a new directory, open it and perform a git init to create a new git repository. |
2 | Checkout a repository | You can create a working copy of a local repository by running the command
You can also use a remote server url to clone repository, your command will be |
3 | Adding changes file | You can propose changes (add it to the Index) usinggit add index.html style.css function.js or git add * |
4 | Commit or saving your local changes | This is the first step in the basic git workflow . Now the files is committed in your local repository. To actually commit these changes usegit commit -m "Commit message" |
5 | Pushing Your Changes | Your changes are now in the HEAD of your local working copy. To send those changes to your remote repository, executegit push origin development[Branch Name] |
6 | Creating Branch | Branches are used to develop features or functionality isolated from each other. Master branch is the “default” branch when you create a repository. You can use other branches for development and merge them back to the master branch upon completion to collect all of your individual module. -Create a new branch named “design_branch” and switch to it usinggit checkout -b design_branch git checkout master |
7 | Deleting branch | any off your breach can be delete using -d.git branch -d design_branch |
8 | Update & Merge | To update your local repository to the newest commit, executegit pull in your working directory to fetch and merge remote changes.To merge another branch into your active branch (e.g. master), use git merge branch_name in both cases git tries to auto-merge changes. Unfortunately, this is not always possible and results in conflicts. You are responsible to merge those conflicts manually by editing the files shown by git. After changing, you need to mark them as merged with git add filename |
[paypal-donation]