Git work flow E3SM

1) Fork a branch to my own repo on Github

2) Clone a branch from my own repository with submodules

$ git --recursive -b branch/name/here

3) Make changes to the code, add them,and commit

$ git add --all
$ git commit –a -m "comments to this commit"

4) Push changes to my repo

$git push origin name/of/the/branch:name/of/the/branch

5) Send pull request on Github

Additional commands

check submodule list

$ git submodule

if there are submodules, clone the submodules by

$ git submodule init
$ git submodule update


check remote and branch

$ git remote 
$ git branch -v

Add aliases

This following command create a “git hist” aliases based on “git log” to visually check the commit history

git config --global alias.hist "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short"

Go back to old commits

find the hash of the target commit by checking the commit history, then

git checkout    # something like "git checkout 911e8c9"

Add ssh key to Github to avoid input password

  • Type cd ~/.ssh.
  • Within the .ssh folder, there should be these two files: id_rsa and If not, create them by typing
 ssh-keygen -t rsa -C ""
  • Open, copy everything and paste it into GitHub and/or BitBucket under the Account Settings, SSH Keys

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s