git gist


quick recap: file:///Users/Lucy/Desktop/github-git-cheat-sheet.pdf

Everyday work :  commit ->pull->if conflicts commit->push


routine to commit and push: git status->git add xx( git add '*.txt')->git commit -m 'Add all txt file'->(git remote add origin https://github.com/try-git/try_git.git->git push -u origin master)/git push(after the first time)

routine to pull:git pull origin master->git diff HEAD

routine to branch out and merge:git branch XX->git checkout <branch>->DO STH->git checkout master->git merge XX->git branch -d <branch name>


Undo: Files can be changed back to how they were at the last commit by using the command: git checkout -- <target>

Unstage:You can unstage files by using the git reset command(git reset octofamily/octodog.txt). 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. 



Notes:

Notice how Git says changes to be committed? The files listed here are in the Staging Area, and they are not in our repository yet. We could add or remove files from the stage before we store them in the repository.

Think of Git's log as a journal that remembers all the changes we've committed so far, in the order we committed them

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.

In this case we want the diff of our most recent commit, which we can refer to using the HEAD pointer

Another great use for diff is looking at changes within files that have already been staged(git diff --staged). Remember, staged files are files we have told git that are ready to be committed. Use add to stage a file. 

You can finally remove all those pesky octocats by using the git rm command which will not only remove the actual files from disk, but will also stage the removal of the files for us.

you just need to switch back to the master branch so you can copy (or merge) your changes from the clean_up branch back into the master branch


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值