Basic Git Commands: Cheat Sheet

In the programming of serious automated systems, as a rule, several developers are involved who are working on the same project. At the same time, it is necessary to somehow realize the possibility of parallel task management without prejudice to it. Each team member should know that he is writing code that another programmer will not be able to delete or change subsequently.

At the same time, it is very important to be able to view the history of changes in development, thereby quickly and reliably localizing problem areas and errors.

git commands




Version control systems are called upon to cope with these tasks. And one of them is a product called Git.

Version control systems: a bit of theory

In short - any version control system allows you to save all changes made to the project file. This makes it possible to monitor errors in the code and quickly eliminate them.

:

  • ;
  • ;
  • .

. .





, . , , , . , , , . - , . , .

git bash commands




. — . , , . Git .

Git:

Git . , . , , 3 . 4 , . , .





Git -. , . , . , Git , .

git is not an internal or external command




. , . , . , , .

SHA-1. , , .

Git:

Git, . Windows, Mac OS, Linux.

Windows : git-for-windows.imtqy.com. . , .

basic git commands




, , Git . PATH.

, . , Github . , , . , Git Bash. , . Git Bash :

  • git config --global user.name '''';
  • git config --global user.mail '' ''.

:

  • git config --global core.autocrlf true;
  • git config --global core.safecrlf false.

Git . .

git console commands




Git

  • Init: .

: init .

  • Clone. .

git clone: clone git://github.com/ .

  • Add. Git. — , . , , Git, «».

Git : add _.txt.

  • Status. , . , .

git clone team




  • Diff. . , Git , .
  • Commit. , . Git , , . , , . - , , git add.

Git

  • Reset. . — , , . reset - - hard, , .
  • Rm. git add, . , .

: git rm _.txt.

  • Mv. .
  • Clean. .

.

Git

Git . , , Git. .

  • Branch. , . Branch . git branch . -v . -d . Branch , . git branch _ . , . , _, master.
  • , Git checkout _, .
  • Checkout. , .
  • Merge. .
  • Log. . . , git log -p -2 . -2 , 2 . --stat, git log, , -, . git log , , format pretty. . , get log --pretty=format ''%h, %an, %ar, %s'' , , . .

  • Fetch. git .
  • Pull. git pull — git fetch git merge. , .
  • Push. «», .

  • Remote. . remote , , .
  • Archive. . , , .

Git . , . , Git, .

git cheat sheet




In fact, Git's version control system has enormous potential for configuration and management. The abundance of commands and several keys used in them are the best confirmation of this. For those who wish to study in detail all the properties and settings of Git, there are many manuals, including the official one from Github, which describes in detail the system as a whole and all the subtleties of using commands.




All Articles