how do i track a .txt file using Git?
As I write in a .txt file, how do I keep track of the changes? This will be from the creation of the file until I开发者_C百科'm finished with it. Does the file need to be in a certain place? Special commands required? I have never used open source management software before, so as much advice as you have to spare would be welcome.
I suggest to read the Git Book then.
You have to
Initialize your repository
cd folder git init
Create and add files
vim file.txt git add file.txt
Commit changes
git commit -m"Added some more lines"
Repeat steps 2 and 3 whenever you make changes to your file(s) and want to add them to your repository.
But: You really have to read a tutorial before and get familiar with the basic commands. You don't have to create a git repository at a certain place, any folder will do.
You just have to create a repository and add the file to it. A simple command list can be found here.
All you'd do would be something like the following in an empty directory containing your text file only:
git init .
git add mytextfile.txt
Then, every time you'd like to commit/save current changes or the current version of the file, type:
git commit
or (to add a commit message that can be seen in the commit/version history later on)
git commit -m "Added chapter 5"
精彩评论