github with slack

Credits goes to Sudheer Kumar Tumarada for creating this article with clear explanation.

Introduction:-

Many of us already knew about GIT and Slack .These became  part of our daily life for team collaboration and code sharing .Here i just want to give brief introduction about them and how can we integrate both for better productivity and team collaboration.

 

Slack:-

Slack is a communication tool which allows us to get shared understanding across the teams which will makes us more productive.

1.It’s the foundation for teamwork

2.It simplifies communication

3.It helps everyone find the answers they need

4.It streamlines your work flows

 

Github:-

Github is system which will allow multiple developers/users to work on the same repository/code base.

 

Github-Slack Integration:-

We can have github-slack integration which will allow us to get the information about commits,pull request,deployment statuses and many more.

We can get the following notifications for the events done on our team repository :

  • Commit events
  • Pull requests
  • Issue events
  • PR review events
  • Deployment statuses

 

We can connect Github to slack with following steps:

1)Visit GitHub in Slack’s App Directory.

2)Click Install.

3)Select a channel where GitHub events will be posted.

or click create a new channel to make a brand new one.

4)Click Add GitHub Integration.

5)Click Authenticate your GitHub account.

6)Choose the repositories you’d like Slack notifications for.

7)Choose the GitHub events you’d like to post to Slack.

8)If you’d like, you can customize the way Github posts appear in Slack by choosing a custom display name and icon.

9)When you’re done, click Save Integration.

Once you are done, you will start receiving notification in your slack channel.

Slack will automatically configure and manage which messages we receive from GitHub. To do this, we require write permission to your public and private repos.

 

If you’d prefer not to authenticate your GitHub account, you can switch to unauthed mode and manage the events yourself.

 

Advertisements

How to change pushed commit messages

checkout to the respective branch where you need to change commit titles..

git rebase -i HEAD~3 or 4 – depends on how many you need to check.

Goto the respective line or commit id where you need to change..

press ‘i’ – to insert

change ‘pick’ to ‘r’ – desired commit you would like to

change your commit message..

press esc button and type “:wq” and hit enter

After rebasing successfully..check log by ‘git log -n 3’ to see your changes. come out of this command by pressing ‘q’.

Now do ‘git fetch’ followed by ‘git merge’. Do not forget to press ‘i’ and esc + ‘:wq’

Finally git push origin HEAD

All the best

Configure git inside of sublime text editor windows

Folks,

Lets see the configuration process that needs to be done in order to work with git commands in sublime text editor for workflow..

Prerequisites are

1. Git (command prompt only) – http://git-scm.com/docs

2. Sublime text editor

3. Sublime git package (refer https://sublimegit.net/#installation)

I hope with this you installed git and configured path in environment variables too..

Its better refer this url before you go with installation..

Now lets begin the show.. 😉

Steps:

I am directly moving to the configuration hoping you set the path for git and nodejs in environment variables which includes npm path in AppData too. Now run command prompt..

1. git config –global core.editor “‘c:/program files/sublime text 2/sublime_text.exe’ -w”

With this you can view .gitconfig file in C:/Users/username/ which should be as follows

gitconfig file:

[user]
name = sathya
email = sathya.vakacharla@gmail.com
[core]
editor = ‘C:\\program files\\sublime text 2\\sublime_text.exe’ -w

You can test it by app.js –edit in command prompt like

c:/project/folder/app.js > app.js –edit

this will open app.js file in sublime text editor

2. Now create a folder named sublimegit and extract sublimegit package in to C:\Users\username\AppData\Roaming\Sublime Text 2\Packages\SublimeGit

3. Now restart your sublime text editor

4. Now check your git commands in editor by going to command palette(ctrl+shft+p) and type add/push etc to show up with commands like git:Add etc.

e95969b07ac68c91eacba39d8c30543e727f06d02233-sathya

5. How to add and commit and push to your remote git repository..

after changing necessary code in app.js..just goto command palette and type/choose “git add current file” then followed by “git quick commit” and “git push”

How to find the differences in versions of your files when you pull from git repository..

Sublime Text’s Git package offers several useful diff options, all available from the Command Palette (control+shift+p).

  • “Git: Diff Current File”, which presents a diff of the current file and the last commit
  • “Git: Diff “, which presents a diff of all files in your repository the last commit.

The diff will open up in a new file tab within Sublime Text. What’s nice is that there is syntax highlighting which helps you identify the additions and deletions.

st-git-diff-sathya

Wanna view log??

Just type and select “Git: Quick Log” in command palette to view the latest log for the whole repository.

Blame:

Get an annotated version of the entire current file.
Commit
After adding files, commit them all with a message. (Close the file without saving it to commit)
Quick Commit
Add and commit the current file, after asking for a message.

Status:

Show the status of the repo. Chosing a file gives you a diff of it.

Refer Git Commands for sublime text editor here

Useful commands:

to clone from git repository or any shared path:

git clone git://git.kernel.org/pub/scm/.../linux.git my-linux

to check username/email/etc

git config --list

More Package control repositories for sublime text editor https://packagecontrol.io/

Useful links: https://github.com/kemayo/sublime-text-git/wiki

http://plaintext-productivity.net/2-08-how-to-set-up-git-and-sublime-text-for-version-control.html

git-cheat-sheet-education