Git is an open source version control system to handle programming projects which involve numerous programmers, because it offers the function where we can synchronize the codes, as well as revert to previous version of coding when the current one is not right. Git is command based program but it is easy to learn and use.
Where can I get Git?
How to use (push) upload files to GitHub?
(I am using Windows 64-bit version)
Task: Create a private repository on GitHub and invite other programmers as collaborators.
- Change directory to the folder that you want to work on. “cd” to change the directory (folder).
- Initialize git at the working folder using command “git init”.
- We can check the status of git using command “git status”. Status shows that currently I am working on “branch master”, and there is no “commits” yet. In Git, we can create branch to separate the tasks or portion of the projects, usually master branch is the one we will official deploy it to server, while sub-branches are created and we work on that. Commit is a command to record the codes that we have done so far.
- Add all files in the working folder into track, “git add .”
- git commit -m [message]
- git remote add [origin] [link]
- git push [origin] [master]
Other useful command
- git branch
- git log
- git diff
- git checkout -b
- git checkout
- git reset