appwiki:git

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
appwiki:git [2024/04/11 07:48] – [Command Git cmds] yingappwiki:git [2024/04/11 08:51] – [Command Git cmds] ying
Line 7: Line 7:
 ====== Command Git cmds ====== ====== Command Git cmds ======
  
 +The Three States of Git
 +  * **Modified**: A file is modified when you have changed it but have not yet committed it to your repository. It is only changed in your working directory.
 +  * **Staged**: A modified file becomes staged when you **add it** to your staging area. Here, Git has it marked as ready to be committed in the next snapshot. This means you've told Git to include the updates from this file in the upcoming commit.
 +  * **Committed**: Once a file is committed, it means that the data is safely stored in your repository's local database. This updates the commit history with a new snapshot of your project at the time you made the commit.
 +
 +Cmds
   * start the git-cmd.exe and now you are in a cmd with git built-in, or add git path to your cmd session: <code>set PATH=D:\path_to_git_folder\bin;%PATH%</code>   * start the git-cmd.exe and now you are in a cmd with git built-in, or add git path to your cmd session: <code>set PATH=D:\path_to_git_folder\bin;%PATH%</code>
   * create a default user if you have not <code dos>   * create a default user if you have not <code dos>
Line 47: Line 53:
 git remote -v git remote -v
 </code> </code>
-  * git list branch, both local and remote branch<code dos>git branch -a</code>+  * git list branch,  
 +    * both local and remote branch<code dos>git branch -a</code> 
 +    * both local branch<code dos>git branch</code> 
 +  * git check all changes to files in detail, this is before changes added (not yet commit) <code dos>git diff</code> 
 +  * always get source update before push <code dos>git pull origin branch-name 
 +git push origin branch-name 
 +</code> 
 +  * create branch for a feature or a issue <code dos>git branch export-feature</code> 
 +  * switch branch <code dos>git checkout export-feature</code> 
 +  * push to remote repo <code dos>git push -u origin export-feature</code>
 Extra Tips: Extra Tips:
   * you can use vscode to open the folder project (the one with .git hidden folder), vscode will auto know it is a git project and it has some built-in tool to help you instead of using the git cmd   * you can use vscode to open the folder project (the one with .git hidden folder), vscode will auto know it is a git project and it has some built-in tool to help you instead of using the git cmd
  • appwiki/git.txt
  • Last modified: 2024/05/08 06:01
  • by ying