Tác giả Chủ đề: Câu lệnh GIT thông dụng  (Đọc 2994 lần)

0 Thành viên và 1 Khách đang xem chủ đề.

Offline admin

  • Administrator
  • Trung tướng
  • *****
  • Điểm yêu thích +105/-0
  • Giới tính: Nam
  • Học, học nữa, học mãi
    • Diễn đàn Nhật Bản
  • Paypal Account: admin@diendannhatban.info
Câu lệnh GIT thông dụng
« vào lúc: Thứ bảy, 8/10/2016, 08:46:33 am »
1. Giới thiệu
*Keyword
- Tracking: quản lý, theo dõi mã nguồn

2. Một số câu lệnh GIT thông dụng
# Xoá tất cả file và thư mục hiện chưa được tracking bởi git
Code: Bạn không thể xem liên kết này. Đăng ký hoặc Đăng nhập
git clean -f -n // kiểm tra file nào sẽ bị xoá
git clean -f // chỉ xoá file
git clean -d // chỉ xoá thư mục
git clean -fd // xoá cả file và thư mục

# SSH Đổi mật khẩu passphrase
Code: Bạn không thể xem liên kết này. Đăng ký hoặc Đăng nhập
ssh-keygen -p
# Start the SSH key creation process
Enter file in which the key is (/Users/you/.ssh/id_rsa): [Hit enter]
Key has comment '/Users/you/.ssh/id_rsa'
Enter new passphrase (empty for no passphrase): [Type new passphrase]
Enter same passphrase again: [One more time for luck]
Your identification has been saved with the new passphrase.

# Trở về trạng thái trước khi commit (Undo về 1 commit trước đó)
Code: Bạn không thể xem liên kết này. Đăng ký hoặc Đăng nhập
git reset HEAD~1

# Xoá file trên tất cả các commit
Code: Bạn không thể xem liên kết này. Đăng ký hoặc Đăng nhập
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch PATH-TO-FILE' --prune-empty --tag-name-filter cat -- --all

# Submodule
Code: Bạn không thể xem liên kết này. Đăng ký hoặc Đăng nhập
# pull latest of all git submodules
# git 1.8.2 or above, the option --remote was added to support updating to latest tips of remote branches
git submodule update --remote --recursive
# git 1.7.3 or above
git submodule update --recursive

git pull --recurse-submodules
git submodule update --remote --merge # update submodule to the latest commit

# Remove submodule
git rm --cached path_to_submodule

3. Tham khảo
- Bạn không thể xem liên kết này. Đăng ký hoặc Đăng nhập
- Bạn không thể xem liên kết này. Đăng ký hoặc Đăng nhập
- Bạn không thể xem liên kết này. Đăng ký hoặc Đăng nhập
- Bạn không thể xem liên kết này. Đăng ký hoặc Đăng nhập
« Sửa lần cuối: Thứ hai, 14/03/2022, 09:41:12 am gửi bởi admin »


Diễn đàn Nhật Bản