Source Control, version control and git
1) Bitbucket (SourceTree), github desktop or SVN for source control
Also Git Cola and Git DAG on Linux
Gitbash or Git for windows for Windows (link)
Git tutorial for novices (link)
2) Git commands
git checkout <>
git merge <>
git stash
git checkout -- .
git branch mapgraph_title_legends
git checkout mapgraph_title_legends
git commit -m "changes to title and legends plots"
git push --set-upstream origin mapgraph_title_legends
# also helps you to switch to master if you are on another branch
git checkout master
git pull
3) git command to make new branch
git checkout -- . # if no changes locally that need to be stashed
git status
git branch time_heatmap_pup
OR # if no changes locally (clean directory)
git status
git pull
git branch multiple_imts_oneatatime
git branch -b multiple_imts_oneatatime # will create and checkout to the same
git checkout multiple_imts_oneatatime
# make changes and then ..
# make changes to files that need to be computed name them
git add <name_of_files>
git commit .
git commit -m "changes to title and legends plots"
# if there is not a corresponding node in master
git push --set-upstream origin time_heatmap_pup
git checkout mapgraph_title_legends
# Always clone repo; that copies in the .git files
# go to that folder and type this command
git clone https://github.XX
4) Git command to save in local/working directory
git stash
5) Setting your local Git email address using the git config command
git config user.email “soumya.banerjee@XX.au”
git config user.email
git config --global user.name 'neelsoumya'
6) Git pull request
go to branch using the browser, if you want pull into master from imt_multiple branch
master (left hand side) and imt_multiple on right hand side
7) Merge with another branch or pull in changes from another branch (link)
First push and commit all your changes in your branch.
You are on branch new-decision-model_traffictimes
# goto branch where you want to pull in changes
git checkout new-decision-model
git pull
git checkout new-decision-model_traffictimes
git merge new-decision-model
conflicts will not be flagged
Manually solve those conflicts by editing those files and looking for <<<< symbols
then push those changes
git add <files changed>
git commit -m “changes”
git push
8) Pulling in changes but conflict with own file
git stash
git pull
git stash pop
then
git commit -m “message“
9) Remove files from repository
rm <filename>
git rm <filename>
10) Raise issue on github to track issues and assign to users
11) git tag (to create version)
12) Change remote server address
# check current URLs
git remote -v
git remote set-url origin <URL>
other remote commands
requesting a remote for a fork (link)
git remote -v
git remote add upstream https://github.com/datashield/dsBase.git
sync a fork (link)
git fetch upstream
git status # on absolute_newbie_client
git merge upstream/v6.2-dev_cox
if there are merge conflicts, resolve them (link)
merging a pull request and pull request (link)
then
git commit -m "merge edit"
git push
13) SVN commands
svn add # to add new files to repo
svn co # first time checkout
svn update # get all files (like pull)
svn commit -m "message" # commit and push
svn revert *
14) To change settings for git like username etc go into .git folder and edit config file