Advertisement
Guest User

Untitled

a guest
Jun 20th, 2012
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1.  
  2. $ git init test
  3. Initialized empty Git repository in test/.git/
  4.  
  5. $ cd test
  6.  
  7. $ echo hello > file
  8.  
  9. $ git add file
  10.  
  11. $ git commit -m "adding file"
  12. [master (root-commit) 6f0412e] adding file
  13. 1 file changed, 1 insertion(+)
  14. create mode 100644 file
  15.  
  16. $ git st
  17. # On branch master
  18. nothing to commit (working directory clean)
  19.  
  20. $ echo file > .gitignore
  21.  
  22. $ git st
  23. # On branch master
  24. # Untracked files:
  25. # (use "git add <file>..." to include in what will be committed)
  26. #
  27. # .gitignore
  28. nothing added to commit but untracked files present (use "git add" to track)
  29.  
  30. $ vim file # make some changes
  31.  
  32. $ git st
  33. # On branch master
  34. # Changes not staged for commit:
  35. # (use "git add <file>..." to update what will be committed)
  36. # (use "git checkout -- <file>..." to discard changes in working directory)
  37. #
  38. # modified: file
  39. #
  40. # Untracked files:
  41. # (use "git add <file>..." to include in what will be committed)
  42. #
  43. # .gitignore
  44. no changes added to commit (use "git add" and/or "git commit -a")
  45.  
  46. # although 'file' has been added to .gitignore, changes show up because it was
  47. # already tracked
  48.  
  49. $ git rm --cached file
  50. rm 'file'
  51.  
  52. $ git st
  53. # On branch master
  54. # Changes to be committed:
  55. # (use "git reset HEAD <file>..." to unstage)
  56. #
  57. # deleted: file
  58. #
  59. # Untracked files:
  60. # (use "git add <file>..." to include in what will be committed)
  61. #
  62. # .gitignore
  63.  
  64. $ git commit -m "deleted file from repo"
  65. [master 0e9cd8f] deleted file from repo
  66. 1 file changed, 1 deletion(-)
  67. delete mode 100644 file
  68.  
  69. $ vim file
  70.  
  71. $ git st
  72. # On branch master
  73. # Untracked files:
  74. # (use "git add <file>..." to include in what will be committed)
  75. #
  76. # .gitignore
  77. nothing added to commit but untracked files present (use "git add" to track)
  78.  
  79. $ vim .gitignore # now remove the line which says 'file'
  80.  
  81. $ git st
  82. # On branch master
  83. # Untracked files:
  84. # (use "git add <file>..." to include in what will be committed)
  85. #
  86. # .gitignore
  87. # file
  88. nothing added to commit but untracked files present (use "git add" to track)
  89.  
  90. # file shows up again as untracked, as I expected
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement