<\/span><\/h2>\nTo create a new repository, the command git init<\/span> is used, within your directory. The repository is contained within the .git<\/span> folder.<\/p>\n<\/span>Workflow<\/span><\/h2>\nThree trees are maintained by git, within your local repository. They are,<\/p>\n
\nWorking Directory<\/strong> consists of the actual files you are working on.<\/li>\nStaging Area (Index)<\/strong> used for preparing commits. All changes that you want to commit are staged on the first. The index provides greater control over what changes should be committed into the Repository.<\/li>\nObject Store (Repository) <\/strong>contains committed changes from the staging area.<\/li>\n<\/ul>\n <\/picture><\/p>\n<\/span>Add\/Commit<\/span><\/h2>\nFiles can be added to the staging area by using either git add <filename><\/span> or git add .<\/span> (for all modified files). \nTo commit the files from the staging area to the local repository use git commit -m “comment”<\/span><\/p>\n<\/span>Branches<\/span><\/h2>\nBranches are used to develop new features in isolation. Once the changes\/branch have been tested, the branch is then merged back into master branch. The feature branch<\/em> is then deleted. Below are the main branch commands,<\/p>\n\n\n\ngit checkout -b feature-add_button<\/span><\/td>\n create new branch<\/td>\n<\/tr>\n \ngit checkout master<\/span><\/td>\n switch to master branch<\/td>\n<\/tr>\n \ngit branch -d feature-add_button<\/span><\/td>\n delete branch<\/td>\n<\/tr>\n \ngit branch<\/span><\/td>\n list branches<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/span>Pushing<\/span><\/h2>\nTo push the changes from your local repository to a remote repository (i.e github) enter git push origin master<\/span>. It is worth noting that master<\/span> relates to the name of the remote branch.<\/p>\nIf you have not cloned an existing repository and want to connect your repository to a remote server, you will need to add it with the commands git remote add origin <server><\/span> [2]<\/sup><\/p>\n