Git commit code step using a command line

Use the command-line submit code step
into your project directory
1: pull the server code, to avoid overwriting other people Code
git pull
2: View the current project which files are modified
git status
specific state as follows:
1: untracked: untracked, general as a new file, this file in the folder, but has not added to the git repository, version control is not involved by the state to git add Staged..
2: modified: file has been modified, only the modified and no other operation.
3: deleted: deleted files, delete locally, on the server has not been deleted.
4: Renamed:

3: the code will be submitted to the buffer status change
git add + file
git add -u + path: the modified tracking code is submitted buffer
git add -A + Path: The modified code is not submitted to the track buffer
e.g. :
Git the Add -u vpaas-frontend / src / components
which has been modified code under vpaas-frontend / src / components directory is submitted to the cache tracked

git add -A vpaas-frontend / src / components
which has been modified code under vpaas-frontend / src / components untracked submitted to the directory cache

git add.
Using the above command will commit all modified files to the cache area

4: The code is submitted to the local repository
git commit -m "modified project code"

5: the cache server codes push Git
git push

FAQ
1: mistakenly submitted the code to the cache (cache mistakenly codes submitted using the git add command)
Solution: use git reset command to withdraw the code cache.

2: Code mistakenly submitted to the local repository (git commit command mistakenly use the code submitted to the local repository)
Solution:
git the RESET -hard + version
completely roll back to a version of the local code will change on a version of the content .
----------------
Disclaimer: This article is CSDN blogger "Tomorrow horizon" of the original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source and link this statement.
Original link: https: //blog.csdn.net/husong_/article/details/81510711

Guess you like

Origin www.cnblogs.com/andydao/p/11577428.html