- Clone a directory
git clone https://github.com/quentinjamet/CDFTOOLS
- By default, git uses the name
origin
for a remote, so if you dogit clone <url>
it will by default call that remoteorigin
- Use
git remote -v
to see what origin points to
- Make a branch for local development
git checkout branchREF
git branch branchDEV
git checkout branchDEV
(to go to the branch)- to make the upstream copy on origin:
git push --set-upstream origin branchDEV
- Diff local repo with
origin
From https://stackoverflow.com/questions/11935633/git-diff-between-a-remote-and-local-repositorygit diff remote/my_branch my_branch
ORgit fetch origin your_branch
: fetch the branch named 'your_branch' from the remote named 'origin' ; thengit diff --summary FETCH_HEAD
: display diff betweenlocal
andorigin
. You can also use the option--stat
for more details.
- Update local repo with
origin
git pull
: update local repo OR- after a
get fetch
(see below), complet withgit merge
- **Commit and push local devs to origin
git status
: display local changes as compared toorigin
git add your_file
: will addyour_file
to the commitgit commit -m 'a comment'
: commit changegit push
: push local commit toorigin
- Save (or hide) local changes without commiting them. Very useful to change between branches with ongoing devs
git stash
[git stash pop to 'reactivate']
git stash list
git stash show