Git is a version control system also created by Linus Torvals. It is used to manage code version between a group of software developers.
When using Git to version control files, the files will be in one of the three states
Committed is a state in which the code fixes are saved in git. This action of saving code is called committing.
Modified files are literally modified files. If a file's code is changed but not committed yet, the file is in a modified state.
The staged state is a state between committed and modified. A staged file is a file that is modified but not commited yet. It is saved and marked as a file to be commited. Since committing happens when the code is fully developed, the staged stage exists to save a modified file to be reviewed again.
This command turns the project into a got repository.
Move modified file into staged status
Commit the staged file.
Check what edits have been apllied
Check what status files have currently
Shows you the history of commits
remove file from git repository
Used when moving a file within git repo. Usually used when renaming
Used to create a Branch
The git branch command will show you a list of branches.
Used to move between branches.
git config --global user.email “wlsxo2112@naver.com”
git config --global user.name “Kjintae”
git init
git add -A
git commit -m “first commit”
git remote add origin https://github.com/kingofahn/JavaStandardEdition.git
git push -u origin master
git branch <feature/name>
How to move between branches
git checkout -b <branch_name>
The
-b
moves user to the branch made.
Check out a branch from the master. After editing the branch
Since multiple people work on the same file, conflicts will happen if the master file gets merged with another user's update.
When this happens, the pull request will show that there is a conflict.
In this case, use thegit pull origin master
command from within the branch and edit the file in conflict.
Add, Commit and push the edited version and the conflict will be solved.