some notes about git

3512 단어 Note
first step:
 
git config --global user.name "John Doe"
git config --global user.email [email protected]
 
to add user name & email
 
then git config --list to check.
 
git help config to seek help.
 
You can get a Git project using two main approaches. The first takes an existing project or directory and imports it into Git. The second clones an existing Git repository from another server.
 
git init
 
git add *.html
git commit -m "first one"
 
now we build the repository here.
 
You clone a repository with  git clone [url] . For example, if you want to clone the Ruby Git library called Grit, you can do so like this:
$ git clone git://github.com/schacon/grit.git

The main tool you use to determine which files are in which state is the git status command.   To stage it, you run the git add command (it’s a multipurpose command — you use it to begin tracking new files, to stage files, and to do other things like marking merge-conflicted files as resolved).

If you want to see what you’ve staged that will go into your next commit, you can use  git diff --cached . (In Git versions 1.6.1 and later, you can also use  git diff --staged , which may be easier to remember.) This command compares your staged changes to your last commit:
 
Although it can be amazingly useful for crafting commits exactly how you want them, the staging area is sometimes a bit more complex than you need in your workflow. If you want to skip the staging area, Git provides a simple shortcut. Providing the  -a  option to the  git commit  command makes Git automatically stage every file that is already tracked before doing the commit, letting you skip the  git

 
git commit -a -m "commit without staged"
 
To remove a file from Git, you have to remove it from your tracked files (more accurately, remove it from your staging area) and then commit. The  git rm  command does that and also removes the file from your working directory so you don’t see it as an untracked file next time around.
If you simply remove the file from your working directory, it shows up under the “Changes not staged for commit” (that is, unstaged) area of your  git status  output:
 
use git rm --cached to  keep the file in your working tree but remove it from your staging area.
 
git mv  can rename files
 
git log to check historial records. One of the more helpful options is  -p , which shows the diff introduced in each commit. You can also use -2 , which limits the output to only the last two entries:

좋은 웹페이지 즐겨찾기