- vừa được xem lúc

Tổng hợp các câu lệnh GIT dị ít dùng GIT#2

0 0 5

Người đăng: Thống PM

Theo Viblo Asia

Git Bash Commands Cheat Sheet

Inspect & Compare

Traking Path Changes

  1. git ls-files # List all files tracked by Git
  2. git blame <file> # Show who changed what in a file
  3. git bisect # Find the commit that introduced a bug
  4. git reflog # Show a log of all local commits
  5. git cat-file -p <commit> # Display the content of a commit object
  6. git rev-parse <ref> # Get the SHA-1 hash of a reference
  7. git fsck # Verify the integrity of the repository
  8. git gc # Clean up unnecessary files and optimize the repository

Remove, and Rename

  1. git rm <file> # Remove a file from the repository and working directory
  2. git mv <old-name> <new-name> # Rename or move a file
  3. git clean -f # Remove untracked files from the working directory
  4. git clean -fd # Remove untracked files and directories from the working directory

Tags

  1. git tag # List tags
  2. git tag <tag-name> # Create a lightweight tag
  3. git tag -a <tag-name> -m "<message>" # Create an annotated tag
  4. git push origin <tag-name> # Push a tag to the remote repository
  5. git tag -d <tag-name> # Delete a local tag
  6. git push origin --delete <tag-name> # Delete a remote tag
  7. git tag --contains <commit> # Find tags containing a specific commit
  8. git describe # Describe the most recent tag and commit

Advanced Commands

  1. git submodule add <repository> <path> # Add a Git submodule
  2. git submodule init # Initialize Git submodules
  3. git submodule update # Update Git submodules
  4. git submodule foreach <command> # Execute a command in all submodules
  5. git grep <pattern> # Search for a pattern in the repository
  6. git log -S"<pattern>" # Search for commits that added or removed a pattern
  7. git archive --format=zip --output=<output-file> <branch> # Create a zip archive of a branch
  8. git shortlog # Summarize commit logs by author
  9. git log --graph --decorate --oneline # Display commit history as a graph
  10. git rev-list --count <ref> # Count the number of commits in a branch
  11. git commit --amend # Modify the last commit
  12. git commit --amend -m "<new-message>" # Modify the last commit message
  13. git reflog expire --expire=now --all # Remove all reflog entries
  14. git rev-parse --show-toplevel # Show the root directory of the repository
  15. git config --global alias.<alias-name> '<git-command>' # Create a Git alias
  16. git help <command> # Show help for a Git command

Bình luận

Bài viết tương tự

- vừa được xem lúc

Đặt tên commit message sao cho "tình nghĩa anh em chắc chắn bền lâu"????

. Lời mở đầu. .

1 1 701

- vừa được xem lúc

Tập hợp những câu lệnh GIT hữu dụng

Dưới đây là một vài ví dụ về các câu lệnh Git mà tôi thường dùng. git config --global user.name "John Doe". git config --global user.

0 0 55

- vừa được xem lúc

Cấu hình CI/CD với Github (phần 2): Trigger một work flow

Events trigger. Bạn có thể cấu hình cho workflows chạy khi có một sự kiện nào đó xảy ra trên GitHub, theo một lịch có sẵn hoặc cũng có thể là một sự kiện nào đó xảy ra ngoài GitHub.

0 0 70

- vừa được xem lúc

Cấu hình CI/CD với Github (phần 1): Một ít lý thuyết

CI/CD là gì. Về mặt khái niệm là vậy nhưng về mặt triển khai thì CI/CD là quá trình tự động thực hiện các quá trình build, test, release, deploy khi có các trigger như commit/merge code lên một branch định sẵn hoặc có thể là tự động chạy theo một lịch cố định.

0 0 118

- vừa được xem lúc

Giới thiệu về Git LFS

. Git LFS là gì . Git LFS làm điều này bằng cách thay thế các tệp lớn trong repo của bạn bằng một con trỏ nhỏ.

0 0 29

- vừa được xem lúc

Git workflow được Google và Facebook sử dụng có gì hay ho

Với developer thì Git hẳn là công cụ rất quen thuộc và không thể thiếu rồi. Thế nhưng có mấy ai thực sự hiểu được Git.

0 0 66