How do you commit in GitHub ?

I don't know if it's me or my dudeist attitude but when I start a project on GitHub, the first thing I do is to create a project on my profile on the site

After that I clone the repo then I code for example a Phaser game to participate in a gamejam on itch.io/jams with one of my fake accounts

Then :

  • git add .
    I use precisely the dot nothing else

  • git commit -m "First Commit"
    I don't know the diffrence with "Initial Commit"

  • git push origin master
    OFC I use git config user.name/user.email before all this to use my fake accounts

I repeat these steps ... and never finish a project

Did you find this post useful? Show some love!
DISCUSSION (34)

My personal preference is to git add ... -p. Eyeballing each line as I commit it gives me one last sanity check.

I also like to git commit -v so I can refer to the code whilst writing the commit message.

One thing I do a lot is that I like to create a new branch for even the smallest of changes. If I find I need to further prepare for that change, I can create a new branch from master, make the change then head back to the original new branch and rebase.

I also git reset --hard a lot. And, git commit --fixup ... helps me keep my commits tidy but I know if I'm using it a lot, I'm on my way to a mess.

You look like an advanced user @updated_tos , do you have a tutorial reference please ?

These are things I've picked up as I've gone along. I got burnt by git too often when I started out.

tbh I first follow the official documentation in any technology I use and in this case my steps are taken from the official hello world and I didn't change it from the beggining just learned to git add . and always work on the master branch which is not the best as i see in our discussion here

And I just noticed that it is said :

  • Create a repo on the site first O.o

After that it's all about how to commit so it's why I titled this post "How do you commit in GitHub" to start a discussion and to go ahead easy

  • Create a useless branch
  • Accidentally make it useful
  • Really commit to merge the branch to remote master
  • Keep calm and merge the pull request to master
  • Revert the branch
  • Remove the repo
  • Repeat.

What I notice is :

  • Create a branch

I understand that you don't work directly on a master branch

  • Remove the repo

I understand that you don't use that functionality of pulling a remote repo

Can you explain those two points a little bit more please @revskill10

It's just a funny way to hack on your ideas until it works, then you remove the repo and re-create it with your refined idea ;)

Intresting gonna think about it, thank you for the reply

I start working on a project, when I need to add the first commit I

  • git init
  • Head over to Gitlab (where I host most my personal work),
  • Create a repo copy the remote setting and drop in in terminal
  • gitit "some commit message"
  • If I want to experiment I create branches

That's it.

I've set gitit to do this:

gitit() {
    git add .
    git commit -a -m "$1"
    git push --all
}

Quick and easy

(I do the same with Github)

As you said Quick and easy, I like it, I mostly like this feature of creating a branch, I've seen the idea three times in this thread.

Anyway, did you moved to gitlab after M$ bought GiThub ? ;) ;) We should post a subject like this to discuss it here should bring a lot of discussions

I create branches because I feel it is a clearer pinpoint to states I might want to visit later on.

No, I started using gitlab because of the unlimited private repos. So every time I'm creating a new project I "throw" it in gitlab worry free whether or not it's worth of public use. I used to use bitbucket but gitlab's interface is nicer

And since starting dabbling in web dev I had to change computers two times. The first was a horrible experience, me thinking I backed up everything when I didn't. The second time, having had everything (dev related) in GitLab, the transition was so smooth.

Now I have started using GitHub as a public portfolio (though it's still empty apart from code I've created for tutorials I wrote)

I had this logic in the beggining to use other sites then GitHub for private repos then I decided to just use GitHub and when I have to treat a spciale topic or a specifical technology I just create another account (not in the sens of fake) and work on it to let people have a complete idea of what am doing, for instance I'll be creating a repo just for react in the furure

Just wanted to wish you good luck on the game jam.

I never really use commit -m. It's personal preference, I guess, but I'm usually either using a GUI front-end for git or feel more comfortable being able to compose it with vim.

Initially start pushing directly to master, but at some point (when the project is out of the "proof of concept" phase) I'll push to a branch. It's a good habit to get into. But, honestly, with a "throw away" project (like a game jam) I would probably just stick with master.

Thank you for the reply @jeikabu , interesting point to use a special tool to commit. btw, I've seen an excellent post on moving from vim to neovim but am an atom editor addict now and I am testing how to commit with the GitHub app and clone directly a repo from the original project with it till I find my way of doing things until "a proof of concept" phase where I'll probably follow your idea

dev.to is in a "proof of concept" phase isn't it

Waiting for the githubgameoff2018 wish to see you there ;)

Don't just use the GUI for commits, I find it useful for general repository browsing, wrangling branches, etc. Still have to do some things from the command line (like sub-tree and LFS shenanigans), but I like the pretty colors when keeping an eye on a bunch of developers, tons of branches, etc.

Truth be told, I rarely use vim these days (except for commit messages in a git terminal). I'm a VS Code convert. ;)

Too much complicated for me because I think I don't have the right tools to follow the work on specifical repo

We can create some posts about it here to discuss also the topic about VSCode and Atom should be a good post too by releving what was said on the AMA of the new GitHub CEO on Reddit

Nice proposition, I was just saying I don't have to right tools to follow the work that is done on my prefered repos, can't follow the commits and the issues other place then using the GH GUI and discussing on GitHub, will the tool you propose save me from beeing lost ?

I don't think I'm following your question. I think GitKraken is the best GUI for GIT that I've ever used.. and I used most of them. Since I started using GitKraken, I have not had to use the command-line at all. It's very intuitive and straightforward.

I complely agree, GitKraken is a game-changer for git GUIs. I tend to do most of my git remote/branching work in the terminal, but the commit graph and it's commit previews just look so darn good. it's all I use for creating commits and exploring history

I like the enthusiasm that comes with this software, sorry for misunderstanding I am a french speaker in fact and sometimes I start explaining things in english and don't have the right words for it

It cost nothing to give a try so am on my way to test it thx for the discovery

I do exactly what you've described and wrote myself some instructions (helencodes.com/using-git-cmder/)

Learning about branching, merging and, at some point contributing to open source, is all on my list of things to learn about.

I've discovered gitkraken in this thread and it's fine to just follow opensource projects,
I am a cmder user too, I plan to switch to ubuntu shell on Windows 10 as soon as I have a new computer

Make a folder in Dropbox/iCloud/Whatever and init a local repo. Download the minified Phaser and start coding. No npm, no Babel, no baggage.

Absolutely got to read your post, I'm writing an article on medium about Phaser CE
I should reverse the step with

  • git init first
  • create the repository right after

The thing is as I said I am starting to use the GitHub app to clone directly the repos I like to participate so I am sure that it will pull the last changes without command line

and never finish a project....lol

Relevant Reply XD should be treater later and wish to discuss it here mostly PhaserJS games in fact ;)

Create repo on github/gitlab -> git init on local -> create .gitignore
-> git add .gitignore -> git commit -m 'initial commit' -> add remote origin -> push
-> checkout -b develop -> git push origin HEAD -> branch setting on remote (protect/CI etc)
-> checkout -b feature/xxxxxxx -> push origin HEAD -> Pull Request -> SELF REVIEW
-> squash merge -> rebase origin develop -> ..... continue ( ˙꒳​˙ )

woohoo I follow you until git commit -m "Initial commit" then am lost XD

I pretty much only work with myself so I've been using git more as a dedicated back up/move code between different machines tool.

git add . 

git commit -m "a lot of shit"

git push

I don't understand what "when I start a project on GitHub, the first thing I do is to create a project on my profile on the site" means - could you explain a bit further?

Just commented on a Reply that uses git init first then create the repo instead of doing things like me got to think about it because sometimes it just create an empty repo for a while untill the "proof of concept" phase (another comment in this thread)

Thx for the relevant comment :)

simillar steps, fake account not used, after initial commit with readme i commit more.. you know.. actualy do something. try it :P

Indeed I have to commit more but as you said you know ... I think it's the motivation behind to finish something. Anyway, fake accounts are usefull for gamejams and ofc trolls XD
Thx for the feedback ;)

Classic DEV Post from Oct 24

Why I like dev.to

This was originally going to be a post about dev.to's strengths and weaknesses....

Nazim Boudeffa
Hi, I am a coder and a dudeist, excuse my english I am a french speaker that maintain a certain international english level. Follow me and I just follow back, belive me ;)

Let's talk shop πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Sign up (for free)