2018年2月4日

git 的使用

cd gretl-git

#先從遠端 server 更新
git pull

# 在本地產生一個分支,例如叫做 m1
git branch m1

# 切換到 m1 這個分支去編輯
git checkout m1

# 把要更新的檔放進 gretl-git 目錄之後,再用 git add 新增
git add zh_TW.po

# 再確認,並寫下註解在引號中 "...."
git commit -m "for 2018a v1"

# 最後上傳已變更的分支到 server
git push --set-upstream origin m1

==其它的相關指令==
# 看自己有權更新的 repo
git remote -v

# 查看目前狀態
git status

(出現回應如下)
On branch m1
Your branch is up-to-date with 'origin/m1'.
Untracked files:
  (use "git add ..." to include in what will be committed)

    LINGUAS
    Makefile.in.in

...(以下略)

# 查歷史紀錄
git log

==以下的都亂試沒懂==
cd gretl-git
git pull
cd po
git commit zh_TW.po
git push

git add zh_TW.po
git commit -a -m 'Initial commit'
git add
git reset --soft HEAD^
git add zh_TW.po
git commit -a -m 'Initial commit'
remote add origin ssh://USER@git.code.sf.net/u/USER/gretl
git push -u origin master
git commit zh_TW.po
git commit zh_TW.po
git commit ./po/zh_TW.po
git remote add origin ssh://USER@git.code.sf.net/u/USER/gretl
git push -u origin master



==git 2.0 之後有些變動==
我選擇設成 simple

$ git push
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master

沒有留言: