티스토리 뷰

The name of our remote is origin and the default local branch name is master. The -u tells Git to remember the parameters, so that next time we can simply run git push and Git will know what to do.

-u: git에게 parameters를 저장시켜서 다음번에 쉽게 run git push 할 것. 



[Pulling Remotely]

We've invited other people to our GitHub project who have pulled your changes, made their own commits, and pushed them. 

$ git pull origin master


[Differences]

git diff command: last commit과 비교해서 뭐가 달라져야하는지 보는 것 ㅇㅇ 


[Staged Differences]

Another great use for diff is looking at changes within files that have already been staged. Remember, staged files are files we have told git that are ready to be committed.

$ git add command: to stage .../..txt, which I just added to the family for you.


[Staged Differences(cont'd)]

$ git diff --staged


[Resetting the Stage]

So now that octodog is part of the family, octocat is all depressed. Since we love octocat more than octodog, we'll turn his frown around by removing octodog.txt.

You can unstage files by using the git reset command. Go ahead and remove octofamily/octodog.txt.

$ git reset octofamily/octodog.txt


[Undo]

git reset did a great job of unstaging octodog.txt,, but you'll notice that he's still there. He's just not staged anymore. It would be great if we could go back to how things were before octodog came around and ruined the party. 

$ git checkout -- <target> : last commit by using the command에서 파일이 바뀔 수 있는 거니까 ....ㅇㅇ... 

ex) $ git checkout -- octocat.txt


[Branching Out]

When developers are working on a feature or bug they'll often create a copy (aka. branch) of their code they can make separate commits to. Then when they're done they can merge this branch back into their main master branch.


We want to remove all these pesky octocats, so let's create a branch called  clean_up, where we'll do all the work:

$ git branch clean_up (* clean-up 이라고 중간 작대기 쓰지 않도록 하자)


[Switching Branches]

$ git checkout clean_up


[Removing All The Things]

$ git rm command: remove하는 것 


[Commiting Branch Changes]


[Switching Back to master]

clean_up branch back into the master branch

-master branch check

$ git checkout master 


[Preparing to Merge]

merge your changes from the clean_up branch into the master branch

'clean_up'이라는 branch 에서 'master' branch와 merge할 때 ! 

*이미 master branch에 위치해 있다면 $ git merge clean_up 하면 된다. 


[Keeping Things Clean]

$ git branch -d <branch name> command: branch를 삭제할 때 사용한다. 


[The Final Push]

All that's left for you to do now is to push everything you've been working on to your remote repository, and you're done! 


'about Git-Hub' 카테고리의 다른 글

1. 깃텁(Git-Hub) 왕기초  (0) 2017.12.06
댓글